lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2012/6/7 Geoff Leyland <geoff_leyland@fastmail.fm>:

> Is it a dead-end idea, or is it that my implementation [1] is brain dead?

I read the code up to line 34.  Five function-valued local variables,
three of them coded in Lua (not C), had by then been expended to simulate
(presumably for the sake of compatibility with Lua 5.1) something that
comes free of charge in Lua 5.2.

So my first suggestion is:

---

local pairs, ipairs = pairs, ipairs
if _VERSION~="Lua 5.2" then
  -- put those lines here, changing `local function pairs` to
  -- `pairs = function` etc
end

---

and at least under Lua 5.2 you should see some improvement.