lua-users home
lua-l archive

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


> You should be able to get what you want by writing:
> 
>     local function makeBinding(v)
>         return function(x) return g(v,x) end
>     end
> 
>     for k,v in pairs(t) do
>        g_bindings[k] = makeBinding(v)
>     end

A simpler way is

      for k,v in pairs(t) do
         local v = v
         g_bindings[k] = function(x) return g(v,x) end
      end

-- Roberto