Andy Gilbert Posted August 21, 2013 Share Posted August 21, 2013 Ive got myself a little stuck using lua in editor. I have objects with scripts attatched and one of them uses the: Script.entityName = nil --entity "Pivot" so i can reference to that entity within the script, this entity also has a script attatched with some variables set. As i can now access the entity's properties such as GetPosition, GetRotation ETC, How would I access the entities scripts variables? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Andy Gilbert Posted August 21, 2013 Author Share Posted August 21, 2013 Ignore, ive done it. Easy actually Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Pancakes Posted August 21, 2013 Share Posted August 21, 2013 uh...I want to make sure you've done it correctly, so that uh, you don't have any issues with it in the future, mind if I check your methods for you? free of charge of course Quote Core I5 2.67 / 16GB RAM / GTX 670 Zbrush/ Blender / Photoshop CS6 / Renoise / Genetica / Leadwerks 3 Link to comment Share on other sites More sharing options...
Andy Gilbert Posted August 21, 2013 Author Share Posted August 21, 2013 Of course. Sorry i should have put this for others. When you have a entity referenced that has a script attached with variables initialised within. Its a simple case of: myVar = self.entity.script.VarName As a side note, i got this from looking through darkness awaits scripts. Andy 1 Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Admin Posted August 21, 2013 Share Posted August 21, 2013 myVar = self.entity.script.VarName In your example there, "self" and "script" are the same object, so this is more straightforward: myVar = self.VarName To access values on another entity, using a pick result as an example: if world:Pick(0,0,0, 0,0,1, pickinfo) then if pickinfo.entity.script~=nil then a = pickinfo.entity.script.Varname end end 1 Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted August 21, 2013 Author Share Posted August 21, 2013 Ahh I see. Even easier then. Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d 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.