notes/Resources/dev/snippets/lua.md

18 lines
326 B
Markdown
Raw Normal View History

2023-05-04 15:46:51 +02:00
# Lua
2022-02-22 11:27:27 +01:00
## Dump Object to Console
```lua
function dump(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..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
```