meia-lua Posted August 3, 2018 Share Posted August 3, 2018 Hello, After calling some of the LeadWerks functions in Lua it dawned upon me that I have no idea how they have been implemented (not that it makes any difference to use them), I would just like to understand how they have been implemented. I thought the classes would just be Lua tables and then methods are elements within the table but the length of any class is zero. It also appears that the Script class has been implemented differently and doesn't exist as a Lua object. I have seen function calls like this: Quote self.entity:Turn(0,0,1) Wouldn't self be redundant if Lua represented all classes such as entity as tables. Quote Link to comment Share on other sites More sharing options...
Josh Posted August 4, 2018 Share Posted August 4, 2018 Basically, in Lua a table is associated with an entity, and the entity is a member of the table. thus you call self.entity to get the entity. The entity object in Lua is a "userdata" object. I think they use metatables or something to represent the C++ functions. I use tolua++ for the binding code. 1 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...
meia-lua Posted August 4, 2018 Author Share Posted August 4, 2018 Thanks for the details Josh Quote 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.