forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

args in funcs in tables

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
the underminer



Joined: 03 Oct 2005
Posts: 124
Location: Netherlands

PostPosted: Thu Sep 07, 2006 5:13 pm    Post subject: args in funcs in tables Reply with quote

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
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Fri Sep 08, 2006 11:37 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group