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:
parent
ab15c1149f
commit
c2c7d8f3f6
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user