Skip to content

Commit

Permalink
OrderedMap now defines __pairs for Lua 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedonovan committed Jun 7, 2012
1 parent 9deab58 commit ba40a1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/pl/OrderedMap.lua
Expand Up @@ -29,7 +29,7 @@ end

local assert_arg,raise = utils.assert_arg,utils.raise

--- update an OrderedMap using a table. <br>
--- update an OrderedMap using a table.
-- If the table is itself an OrderedMap, then its entries will be appended. <br>
-- if it s a table of the form <code>{{key1=val1},{key2=val2},...}</code> these will be appended. <br>
-- Otherwise, it is assumed to be a map-like table, and order of extra entries is arbitrary.
Expand Down Expand Up @@ -130,6 +130,8 @@ function OrderedMap:iter ()
end
end

OrderedMap.__pairs = OrderedMap.iter

function OrderedMap:__tostring ()
local res = {}
for i,v in ipairs(self._keys) do
Expand Down

0 comments on commit ba40a1d

Please sign in to comment.