lua-users home
lua-l archive

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


On 20/06/2011 13:29, Philippe Lhoste wrote:
for k, v in pairs(ops) do
if k == exp then
local b = v(what, number)
print("Found with " .. exp)
if b then print("OK") else print("NOK") end
break
end
end

Ooh, more rusty on Lua than I thought...
Replace the above with:

local v = ops[exp]
-- Perhaps check if v isn't nil
local b = v(what, number)
if b then print("OK") else print("NOK") end

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --