Prototype: fix table.sort failing to compare number keys with string keys
This commit is contained in:
parent
f2af58a653
commit
8080b79b68
@ -25,7 +25,7 @@ function Prototype:__tostring()
|
|||||||
-- load and sort table keys
|
-- load and sort table keys
|
||||||
local tkeys={}
|
local tkeys={}
|
||||||
for k in pairs(self) do table.insert(tkeys, k) end
|
for k in pairs(self) do table.insert(tkeys, k) end
|
||||||
table.sort(tkeys)
|
table.sort(tkeys, function(a,b) return tostring(a)<tostring(b) end)
|
||||||
-- iterate over our table
|
-- iterate over our table
|
||||||
for _,k in ipairs(tkeys) do
|
for _,k in ipairs(tkeys) do
|
||||||
local v = Prototype.__tostring(self[k])
|
local v = Prototype.__tostring(self[k])
|
||||||
|
Loading…
Reference in New Issue
Block a user