| View previous topic :: View next topic |
| Author |
Message |
sg57
Joined: 14 Oct 2005 Posts: 154
|
Posted: Mon Jan 30, 2006 8:02 am Post subject: Running a LUA script through C/C++, how do i do it? |
|
|
| 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 |
|
 |
MikeDX
Joined: 19 Oct 2005 Posts: 30
|
Posted: Mon Jan 30, 2006 8:29 am Post subject: |
|
|
| well you could always just execute luaplayer + your script from your main eboot.... and have your script exit cleanly |
|
| Back to top |
|
 |
sg57
Joined: 14 Oct 2005 Posts: 154
|
Posted: Mon Jan 30, 2006 8:33 am Post subject: |
|
|
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 |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Mon Jan 30, 2006 12:51 pm Post subject: |
|
|
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 |
|
 |
sg57
Joined: 14 Oct 2005 Posts: 154
|
Posted: Mon Jan 30, 2006 1:20 pm Post subject: |
|
|
| alright, i guess il port em, this will be difficult... |
|
| Back to top |
|
 |
charliex
Joined: 26 Jan 2006 Posts: 16
|
Posted: Tue Jan 31, 2006 6:20 am Post subject: |
|
|
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 |
|
 |
|