"table as parameter" problem (I AM A NEWBIE)
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: "table as parameter" problem (I AM A NEWBIE)
- From: 桑伟 <gsunwaym@...>
- Date: Mon, 9 Apr 2012 17:52:44 +0800
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)
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?