lua-l archive
[
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)
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?
Follow-Ups
:
Re: "table as parameter" problem (I AM A NEWBIE)
,
Rena
Re: "table as parameter" problem (I AM A NEWBIE)
,
Robert G. Jakabosky
Re: "table as parameter" problem (I AM A NEWBIE)
,
Patrick Rapin
Prev by Date:
Re: What makes Lua tick?
Next by Date:
Re: "table as parameter" problem (I AM A NEWBIE)
Previous by thread:
Re: What makes Lua tick?
Next by thread:
Re: "table as parameter" problem (I AM A NEWBIE)
Index(es):
Date
Thread