Add function to dump tables as string

This commit is contained in:
NullBite 2022-03-16 13:27:56 -04:00
parent c951d0b164
commit 9ff1c3abf2
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -11,6 +11,23 @@ offset_u_face=64
offset_v_face=0
armor_enabled=true
-- utility functions -- {{{
--- dump table --
function dumpTable(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dumpTable(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
-- }}}
-- initialize values --
function player_init()
old_health=player.getHealth()