Refactor AL_value_to_string -> AL_property_to_string

master
Zughy 2022-01-08 00:11:22 +01:00
parent 1cf51640cb
commit c4cc6d2c1b
3 changed files with 10 additions and 10 deletions

View File

@ -167,7 +167,7 @@ function get_properties_formspec(p_name, mod, arena, sel_idx)
-- ottengo una stringa con tutte le proprietà
for property, v in pairs(mod_ref.properties) do
properties = properties .. property .. " = " .. FS(AL_value_to_string(arena[property])) .. ","
properties = properties .. property .. " = " .. FS(AL_property_to_string(arena[property])) .. ","
properties_by_idx[i] = property
i = i + 1
end
@ -181,7 +181,7 @@ function get_properties_formspec(p_name, mod, arena, sel_idx)
-- e assegno il valore
sel_property_attr[p_name] = {id = sel_idx, name = sel_property}
sel_property_value = FS(AL_value_to_string(arena[sel_property]))
sel_property_value = FS(AL_property_to_string(arena[sel_property]))
properties = properties:sub(1,-2)

View File

@ -67,7 +67,7 @@ function get_settings_formspec(p_name, sel_idx)
-- ottengo una stringa con tutte le impostazioni
for setting, v in pairs(mod_ref.settings) do
settings = settings .. setting .. " = " .. FS(AL_value_to_string(mod_ref.settings[setting])) .. ","
settings = settings .. setting .. " = " .. FS(AL_property_to_string(mod_ref.settings[setting])) .. ","
settings_by_idx[i] = setting
i = i + 1
end
@ -81,7 +81,7 @@ function get_settings_formspec(p_name, sel_idx)
-- e assegno il valore
sel_setting_attr[p_name] = {id = sel_idx, name = sel_setting}
sel_setting_value = FS(AL_value_to_string(mod_ref.settings[sel_setting]))
sel_setting_value = FS(AL_property_to_string(mod_ref.settings[sel_setting]))
settings = settings:sub(1,-2)

View File

@ -25,14 +25,14 @@ end
function AL_value_to_string(value)
function AL_property_to_string(property)
if type(value) == "string" then
return "\"" .. value .. "\""
elseif type(value) == "table" then
return tostring(dump(value)):gsub("\n", "")
if type(property) == "string" then
return "\"" .. property .. "\""
elseif type(property) == "table" then
return tostring(dump(property)):gsub("\n", "")
else
return tostring(value)
return tostring(property)
end
end