Running a LUA script through C/C++, how do i do it?
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?
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
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
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.
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.