lua-users home
lua-l archive

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


Hi, all
Sorry for this stupid question. I try to keep it simple. I have two files:
-- file1 --------------
module(..., package.seeall)
function new()
  local t = {}
  function t:p(params)
    print(params.name)
  end
  return t
end
--- file2 -------------
f1 = require("f1").new()
local t = { name = "haha" }
f1.p(t)

When I run "lua52 f2.lua" at my macbook. I got these error messages:
lua52: ./f1.lua:6: attempt to index local 'params' (a nil value)
stack traceback:
./f1.lua:6: in function 'p'
f2.lua:3: in main chunk
[C]: in ?

Anybody can help?