Rastar Posted February 13, 2016 Share Posted February 13, 2016 When running an app from the IDE, the following line in App.Start() (I don't have an App.lua, so it's trying to execute Main.lua) //Invoke the start script if (!Interpreter::ExecuteFile(scriptpath)) { will throw an error First-chance exception at 0x76C23E28 in MTLighting.debug.exe: Microsoft C++ exception: common::CNamedArgsUndefinedNameException at memory location 0x00CFE7A4. First-chance exception at 0x76C23E28 in MTLighting.debug.exe: Microsoft C++ exception: common::CNamedArgsUndefinedNameException at memory location 0x00CFE774. The execution jumps out here and continues when stopping the application (Esc) at //Call the App:Start() function Interpreter::GetGlobal("App"); if (Interpreter::IsTable()) in App.Start(), and then executes App.Loop() (which returns right away). Quote Link to comment Share on other sites More sharing options...
Rastar Posted February 13, 2016 Author Share Posted February 13, 2016 Mmmmh, it's been a while since I did some programming in Leadwerks, and things seem to have changed slightly... If I see this right, for C++ projects the Main.lua script is executed in App::Start(), which contains the game loop. And when this is ended, the C++ execution continues in App::Start(), then App::Loop() (which basically does nothing). Also, since everything is done in Main.lua, the World, Context, Camera and Window member variables are all null. I can change this according to my needs, but I think for C++ projects there should be a template with a clean lifecycle implementation done in C++. When I choose a C++ project, I prefer to use Lua for encapsulated entity behavior, but use C++ for the heavy lifting in the background. Quote Link to comment Share on other sites More sharing options...
Rick Posted February 13, 2016 Share Posted February 13, 2016 Yeah for the C++'ers it's annoying now how things are setup. If I work in a C++ project I usually gut all the C++ code that's there and start from scratch with my own setup. Quote Link to comment Share on other sites More sharing options...
Josh Posted February 15, 2016 Share Posted February 15, 2016 The App() approach was implemented for mobile, which is no longer a concern. Lua has moved into a single main.lua file, but for old projects the App.lua file will still be executed in the original manner. The C++ code is still using the App class because changing that would make the documented examples not work. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.