Lunarovich Posted March 11, 2015 Share Posted March 11, 2015 Hello! This one's driving me crazy. I can't simply understand why I get an attempt to call method 'setPosition' (a nil value) et the entity:setPosition(spawnPos) This two lines print(entity:GetKeyValue("name")) print(self.respawnPoint:GetKeyValue("name")) give me a desired output: Player name Spawn point name Here is the code... Script.respawnPoint = "" --entity "Respawn point" function Script:Collision(entity, position, normal, speed) if (entity:GetKeyValue("name") == "Player") then spawnPos = self.respawnPoint:GetPosition() print(entity:GetKeyValue("name")) print(self.respawnPoint:GetKeyValue("name")) entity:setPosition(spawnPos) end end It seems to me that in the editor everything is setup correctly: Quote Link to comment Share on other sites More sharing options...
Rick Posted March 11, 2015 Share Posted March 11, 2015 Lua is case sensitive. It's SetPosition() not setPosition() 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted March 11, 2015 Share Posted March 11, 2015 you have to make sure you use proper capitalization with lua commands... so its not: entity:setPosition(spawnPos) is should be: entity:SetPosition(spawnPos) edit: yes, rick beat me to it Also, if you are using the internal script editor for your lua scripts, then LE commands will be blue when spelled correctly: 1 Quote 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 More sharing options...
Lunarovich Posted March 11, 2015 Author Share Posted March 11, 2015 Oh, such a silly mistake Thank you! 1 Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted March 11, 2015 Share Posted March 11, 2015 Can't tell you how many times I done the same thing Quote Link to comment Share on other sites More sharing options...
Olby Posted March 11, 2015 Share Posted March 11, 2015 This is why we need LUA code auto-complete. 3 Quote Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64) Link to comment Share on other sites More sharing options...
Lunarovich Posted March 11, 2015 Author Share Posted March 11, 2015 @Olby I agree completely. I've started using Leadwerks only yesterday. Learned a bunch of things in a day (Lua syntax, engine program's flow and API basics). Never seen an engine so transparent, so logical and yet not sipmlistic. Best engine I've used so far, definitely. That said, editor feels really clunky. No window autofocus on tab switch (always have to focus a window with a additional mouse click), as you've said, no autocomplete, even the CTRL - arrows for text navigation does not work as is case with every text editing app that I know! I've started using Atom io with a lua-language package. The only downside is that it does not color semantically valid constructs. 1 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.