Przeglądaj źródła

[lua] fix plain class printing

Justin Donaldson 5 lat temu
rodzic
commit
ee0203d286
1 zmienionych plików z 9 dodań i 6 usunięć
  1. 9 6
      std/lua/_lua/_hx_tostring.lua

+ 9 - 6
std/lua/_lua/_hx_tostring.lua

@@ -3,15 +3,18 @@ function _hx_print_class(obj, depth)
     local first = true
     local result = ''
     for k,v in pairs(obj) do
-        if first then
-            result = result .. ','
-            first = false
-        end
         if _hx_hidden[k] == nil then
-            result = result .. k .. ':' .. _hx_tostring(v, depth+1)
+            if first then
+                first = false
+            else
+                result = result .. ', '
+            end
+            if _hx_hidden[k] == nil then
+                result = result .. k .. ':' .. _hx_tostring(v, depth+1)
+            end
         end
     end
-    return result
+    return '{ ' .. result .. ' }'
 end
 
 function _hx_print_enum(o, depth)