1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

allow dumping nil

This commit is contained in:
grilledham 2019-02-02 17:42:51 +00:00
parent ab15c1149f
commit c2c7d8f3f6
3 changed files with 7 additions and 7 deletions

View File

@ -97,8 +97,8 @@ Gui.on_click(
)
local function update_dump(text_input, data, player)
local ouput = dump_text(text_input.text, player)
if not ouput then
local suc, ouput = dump_text(text_input.text, player)
if not suc then
text_input.style.font_color = Color.red
else
text_input.style.font_color = Color.black

View File

@ -128,7 +128,7 @@ end
function Public.dump_text(text, player)
local func = loadstring('return ' .. text)
if not func then
return nil
return false
end
rawset(game, 'player', player)
@ -138,10 +138,10 @@ function Public.dump_text(text, player)
rawset(game, 'player', nil)
if not suc then
return nil
return false
end
return dump(var)
return true, dump(var)
end
return Public

View File

@ -93,8 +93,8 @@ Gui.on_click(
)
local function update_dump(text_input, data, player)
local ouput = dump_text(text_input.text, player)
if not ouput then
local suc, ouput = dump_text(text_input.text, player)
if not suc then
text_input.style.font_color = Color.red
else
text_input.style.font_color = Color.black