Browse Source

adding utils file

pixelbath 8 months ago
parent
commit
5f796c1351
1 changed files with 14 additions and 0 deletions
  1. 14 0
      utils.lua

+ 14 - 0
utils.lua

@@ -0,0 +1,14 @@
+
+-- dump a table to a string
+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