Captain Cody Posted February 20, 2016 Share Posted February 20, 2016 Title says it all, adding onto the object id integers returns nil local IdAA = getElementModel(selecteda["object"]) if IdAA ~= 1007 then local IdBB = IdAA + 1 elseif IdAA == 1007 then local IdBB = IdAA + 10 end local Objectbbb = createObject ( IdBB, x3,cy,cz, 0, 0, 0, true ) -- Debug says, expected number at argument 1, got nil -- And it seams if I remove the if statement and just do local Objectbbb = createObject ( IdAA+1, x3,cy,cz, 0, 0, 0, true ) It works, but then I cannot add the 10 for the other number Link to comment
Tomas Posted February 20, 2016 Share Posted February 20, 2016 What are you trying to do? Link to comment
Captain Cody Posted February 20, 2016 Author Share Posted February 20, 2016 Found another way to do it-- But what I'm trying to do is making a mirror function for the fully customizational mod shop I'm working in that gets the id of the object in hand, then creates its opposite side version 'Side skirtL -> Side SkirtR' Link to comment
Bonus Posted February 20, 2016 Share Posted February 20, 2016 It's your own fault: local a = 0 if a == 0 then local a = 1 outputChatBox ( a ) --> outputs 1 end outputChatBox ( a ) --> outputs 0 local a = 0 if a == 0 then local b = 0 outputChatBox ( b ) --> 0 else local b = 1 outputChatBox ( b ) --> 1 end outputChatBox ( b ) --> nil Local is only available in the same "block". Blocks are: file function if else elseif for while repeat An end closes the block (not in file). Link to comment
Captain Cody Posted February 20, 2016 Author Share Posted February 20, 2016 Ah ok, though local was just locked to that set function. Link to comment
MAB Posted February 20, 2016 Share Posted February 20, 2016 "object" is wrong, you can't pass elements as strings. local IdAA = getElementModel(selecteda[object]) Link to comment
Bonus Posted February 20, 2016 Share Posted February 20, 2016 selecteda["object"] = element Link to comment
Captain Cody Posted February 21, 2016 Author Share Posted February 21, 2016 "object" is not wrong, the object is assigned to a table earlier in the script. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now