Skip to content

Instantly share code, notes, and snippets.

@Jordach
Created February 22, 2017 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jordach/e74a8f95377452f8d860b2711cd063e0 to your computer and use it in GitHub Desktop.
Save Jordach/e74a8f95377452f8d860b2711cd063e0 to your computer and use it in GitHub Desktop.
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