53 posts
Location
Adelaide, Australia.
Posted 05 March 2013 - 07:36 PM
How can I set a varible in code for example i want to make a varible called vaild. Its uses a string and another varible to make it…
local vaild = "vaild-" .. id
How can I do this… It has always returned an error…
Can I use rawset?
1511 posts
Location
Pennsylvania
Posted 05 March 2013 - 07:46 PM
variable = "testVariable"
anotherVariable = ("test"..variable)
print(anotherVariable)
This will return:
test testVariable
Im almost certain this will work
2005 posts
Posted 05 March 2013 - 09:24 PM
What was the type of id?
797 posts
Posted 06 March 2013 - 12:32 AM
was the error attempt to concatenate string and [something else], if it was then the type of id was not a string so it couldn't join them, fix = 'local valid = "valid-"..tostring( id )'. Other wise, it must be something else in your code.
rawset it for use with metatables i think, it sets the variable without triggering the __index or __newindex metamethod