| View previous topic :: View next topic |
| Author |
Message |
the underminer
Joined: 03 Oct 2005 Posts: 124 Location: Netherlands
|
Posted: Thu Sep 07, 2006 5:13 pm Post subject: args in funcs in tables |
|
|
I'm using this construction a lot:
| Code: |
function test()
--code
end
funcs = {test}
funcs[1]()
|
to call a function from a table. But how can I send arguments along?
The args should be between the () but because there are no () in {test}, I don't know how to do this. It would be very useful, because I use variables know instead of args to control function behaviour with this construction.
thnx for the help _________________ Behold! The Underminer got hold of a PSP |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Fri Sep 08, 2006 11:37 am Post subject: |
|
|
umm here this might help.
varlist = {
funct()
do stuff here... etc
end,
funct()
more stuff here
end,
etc..
}
varlist[1]() 2 3 etc.. can be called using this
You can also define functions as variables.
functionX = funct(foo)
do stuff here
end |
|
| Back to top |
|
 |
|