Skip to content

Instantly share code, notes, and snippets.

@Jordach

Jordach/.lua

Created Feb 22, 2017
Embed
What would you like to do?
wardrobe.formspec_selections_rgb[pname][22] = wardrobe.is_save_hex(fields.acc6)
if wardrobe.is_hex(fields.acc6) then
wardrobe.formspec_selections_rgb[pname][22] = fields.acc6
else
wardrobe.formspec_selections_rgb[pname][22] = "ffffff"
end
end
function wardrobe.is_hex(textfield)
if string.match(textfield, "^[0-9a-fA-F]+$") and #textfield == 6 then
return true
else
return false
end
end
function wardrobe.is_save_hex(textfield)
if string.match(textfield, "^[0-9a-fA-F]+$") and #textfield == 6 then
return textfield
else
return "ffffff"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment