2023-10-11 17:12:47 +00:00
|
|
|
function blockgame.stringify (tab)
|
2023-10-11 07:17:21 +00:00
|
|
|
if type(tab) == "table" then
|
|
|
|
local result = "{ "
|
|
|
|
for key, value in pairs(tab) do
|
|
|
|
result = result .. key .. ": " .. blockgame.stringify(value) .. ", "
|
|
|
|
end
|
|
|
|
return result .. "}"
|
2023-10-15 15:46:08 +00:00
|
|
|
elseif type(tab) == "function" then
|
|
|
|
return "<function>"
|
|
|
|
elseif type(tab) == "boolean" then
|
|
|
|
if tab then return "true" else return "false" end
|
|
|
|
elseif type(tab) == "nil" then
|
|
|
|
return "nil"
|
2023-10-11 07:17:21 +00:00
|
|
|
else
|
|
|
|
return tab
|
|
|
|
end
|
|
|
|
end
|
2023-10-17 12:58:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function blockgame.starts_with (str, start)
|
|
|
|
return string.sub(str, 1, string.len(start)) == start
|
|
|
|
end
|