Jump to content

How can i run LUA script from C++ project?


VeTaL
 Share

Recommended Posts

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 :D )

Working on LeaFAQ :)

Link to comment
Share on other sites

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...

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

"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");

Working on LeaFAQ :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...