mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 15:23:48 +01:00
Schema: Add enum support to settingtypes gen
This commit is contained in:
parent
201f32694f
commit
e3d2d8fba9
14
schema.lua
14
schema.lua
@ -29,6 +29,20 @@ function generate_settingtypes(self)
|
|||||||
default = default and "true" or "false"
|
default = default and "true" or "false"
|
||||||
elseif typ == "string" then
|
elseif typ == "string" then
|
||||||
settingtype = "string"
|
settingtype = "string"
|
||||||
|
if self.values then
|
||||||
|
local values = {}
|
||||||
|
for value in pairs(self.values) do
|
||||||
|
if value:find"," then
|
||||||
|
values = nil
|
||||||
|
break
|
||||||
|
end
|
||||||
|
table.insert(values, value)
|
||||||
|
end
|
||||||
|
if values then
|
||||||
|
settingtype = "enum"
|
||||||
|
type_args = table.concat(values, ",")
|
||||||
|
end
|
||||||
|
end
|
||||||
elseif typ == "number" then
|
elseif typ == "number" then
|
||||||
settingtype = self.int and "int" or "float"
|
settingtype = self.int and "int" or "float"
|
||||||
if self.range and (self.range.min or self.range.max) then
|
if self.range and (self.range.min or self.range.max) then
|
||||||
|
Loading…
Reference in New Issue
Block a user