Jump to content

Reading Lua Class Properties from C++


Birdman
 Share

Recommended Posts

Is there a way to create a variable or property in a class in LUA and access it from C++?

 

For an instance there switch.lua have a Reset time property created in the Property Dialog, and then in the main function you have a resettime variable. How would i access this property/variable from c++?

 

Thanks a lot in advance.

Link to comment
Share on other sites

The engine commands are the same in all languages, either procedural or OOP.

SetEntityKey(entity,"key","value") or Entity::SetKey("key","value")

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Thanks for the responses guys, i got it working.

 

I just checked there was a sample in the viper vehicle lua.

object.model:SetKey("collisiontype",COLLISION_PROP)
object.model:SetKey("mass",1.0)

 

C++ Code:

GetEntityKey(model,"mass");

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