https://bugzilla.wikimedia.org/show_bug.cgi?id=48173

       Web browser: ---
            Bug ID: 48173
           Summary: Lua table serialization (dumping contents of a table)
                    is really painful/annoying
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Scribunto
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified
   Mobile Platform: ---

I'm trying to debug a Lua module. Here's my test input:

---
function test(frame)
    local t = {}
    t[1] = 2
    return t
end
print(test())
---

This input returns the string "table". This is really unhelpful and very
annoying. I want to dump the table. The string "table" provides almost no value
to me at all.

It would be very helpful to have a function that can print something similar to
this:

---
print_table(t)
t = { 1 = 2 }
---

Looking around the Web, it seems that this is a fairly common issue in Lua:

* http://www.luafaq.org/#T1.15
* http://lua-users.org/wiki/TableSerialization
* http://stackoverflow.com/questions/9168058/lua-beginner-table-dump-to-console

I'd like for there to be a built-in function (similar to print_r or var_dump in
PHP or the print statement in Python 2) that allows easy
dumping/printing/serialization of a Lua table for debugging purposes.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to