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 

Running a LUA script through C/C++, how do i do it?

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



Joined: 14 Oct 2005
Posts: 154

PostPosted: Mon Jan 30, 2006 8:02 am    Post subject: Running a LUA script through C/C++, how do i do it? Reply with quote

i made my credits for my game in LUA for ease and now i wnat to run them through C/C++ without having to redo them in c/c++, so is there osme .elf file or something that i could put with the eboot and call some function for it to load it?, i know its possible becuase of the Lua Player, so what would i do?
Back to top
View user's profile Send private message
MikeDX



Joined: 19 Oct 2005
Posts: 30

PostPosted: Mon Jan 30, 2006 8:29 am    Post subject: Reply with quote

well you could always just execute luaplayer + your script from your main eboot.... and have your script exit cleanly
Back to top
View user's profile Send private message
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Mon Jan 30, 2006 8:33 am    Post subject: Reply with quote

what? i have my credits named credits.lua and in my menu, theres a credits button, so i want my credits to load when pressing X on crdits, so what woudl i do there?

and how could i combine luaplayer with ym mine? they dont give out source code?
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Mon Jan 30, 2006 12:51 pm    Post subject: Reply with quote

You can't do it. Or at least, not easily. C++ can't run lua scripts, the only thing you can do is run other programs. Lua Player can run lua scripts(!) so from C++ you need to start the Lua Player program and arrange for Lua Player to execute your credits.lua file, and then for the credits to exit neatly and go back to your C++ program.
1) That's difficult.
2) It might never work cleanly.
3) It'll be slow to launch.

Better either to write the credits in C++, or port the rest of the game to Lua.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Mon Jan 30, 2006 1:20 pm    Post subject: Reply with quote

alright, i guess il port em, this will be difficult...
Back to top
View user's profile Send private message
charliex



Joined: 26 Jan 2006
Posts: 16

PostPosted: Tue Jan 31, 2006 6:20 am    Post subject: Reply with quote

C++ can execute lua scripts, or lua functions, dependant on how luaplayer implemented its psp side of things, you should just be able to include their lua lib equivalent and the liblua and use lua_dofile to parse it

heres a simple example of loading and executing lua from C++

http://tonyandpaige.com/tutorials/lua2.html


presumably luaplayer adds a bunch of PSP glue code, these will need to be included, hopefully its a lua lib.
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 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