From data/scripts/debugtools.lua:
local table_keys = {} for k,v in pairs(obj) do if type(k) == "table" then table.insert(table_keys, k) else table.insert(keys, k) end end table.sort(keys) for i,k in ipairs(table_keys) do -- sort breaks on keys that are tables, so just put them on the end table.insert(keys, k) end
The call to table.sort(keys) makes no attempt to sort same-type variable types and will error out when, for example, a string is compared to a number for sorting.
This can be fixed by splitting each type into their own subtable and then sorting each subtable and then adding them to the keys table.
local tosort_keys = {} for k,v in pairs(obj) do local thetype = type(k) tosort_keys[thetype] = tosort_keys[thetype] or {} table.insert(tosort_keys[thetype], k) end for k,v in pairs(tosort_keys) do if k ~= "table" -- sort breaks on keys that are tables, so just put them unsorted then table.sort(v) end for k,v in pairs(v) do table.insert(keys, v) end end
Steps to Reproduce
Use function 'dumptable' on a table with mixed type keys.
Use function 'dumptable' on a table with mixed type keys.
A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now