VeTaL Posted August 4, 2010 Share Posted August 4, 2010 Okay, if i want to launch entity's code, i may just put LUA code in the file with the same name, as mesh (environment_atmosphere.gmf and environment_atmosphere.lua). But how can i run general script, for example, driver.lua or fpscontroller.lua from C++ project? Well, i understand that i can rewrite that script in C++ syntax, that's not a problem. I'm just interested, how to launch them. (First idea is to create empty mesh and name it like script, but its looking little stupid ) Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted August 4, 2010 Share Posted August 4, 2010 As for setting up lua code without using a empty mesh, you can create a lua script and place it in the Scripts/Start folder. Then run your c++ program that has lua enabled and it will invoke the scripts inside the Start folder. It would also get invoked by lua game scripts. Or you can just call the script from another object's script. I use this to setup global properties. I guess you could use a c++ program to call a commandline "engine.exe scriptname.lua" to run it, but the c++ program wouldn't inherently be able to communicate to it. EDIT--- sorry i am thinking of standalone scripts that use engine.exe... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
VeTaL Posted August 4, 2010 Author Share Posted August 4, 2010 "engine.exe scriptname.lua" Yep, i also thought about this... Looking like, calling script from other object or moving it to Scripts/Start folder is the best solution. I'm just curious, if there is more simple method: instead of calling main script from other object, maybe, it would be better just to RunScript("filename.lua"); Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
macklebee Posted August 4, 2010 Share Posted August 4, 2010 there is the dofile("filename.lua") in lua, but nothing like that has been set yet that I know of in leadwerks engine for c++... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
AndyGFX Posted August 4, 2010 Share Posted August 4, 2010 execute script inside code: lua_dofile(...) lua_dostring(...) http://www.lua.org/manual/2.4/node14.html Quote [HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64 [sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx 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.