Category | Farming Simulator 15 |
Created | 06.04.2015 19:43 |
Adam Plachta (Unknown) | 06.04.2015 19:48 |
---|---|
Hi, I want to write script that remowe old componentJoint and create new, with changed values. I wrote this code: if self.isServer then simulatePhysics(false); removeJoint(self.componentJoints[1].jointIndex); local constr = JointConstructor:new(); local jointDesc = {}; jointDesc.jointNode = self.extraJointNode; constr:setActors(self.components[1].node, self.components[2].node); constr:setJointTransforms(jointNode, jointNode); for i=1, 3 do constr:setRotationLimit(i-1, 0, self.componentJoints[1].rotLimit); end; self.extraJointNode.jointIndex = constr:finalize(); -- this is line 55 simulatePhysics(true); end; in function update, and this line: self.extraJointNode = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.extraJoint#index")); in function load. When I try that in game, in log shows: Error: Running LUA method 'update'. .../.lua:55: attempt to index field 'extraJointNode' (a number value) I know, that my english isn't excellent, but I hope that you understand me ;) |
Emil Drefers (Unknown) | 07.04.2015 09:01 |
---|---|
Hi, seems like you should start with something simpler to learn lua ;) This line: self.extraJointNode = Utils.indexToObject(...... assigns the variable a number. But later on you try to use it as a table: self.extraJointNode.jointIndex = ... That can't work. By the way ... why do you want to edit a componentJoint? You can set a lot of (all!) properties in the xml file for a componentJoint, so it does not make sense to destruct it and recreate it. Cheers, Emil |
Adam Plachta (Unknown) | 08.04.2015 15:22 |
---|---|
Stupid mistake :P I 've found another solution to that. Thanks for help. |
Note: Log in to post. Create a new account here.