please help for dynamic variable name
Posted: Sat Dec 28, 2013 6:53 pm
hi,
sorry because probably my question is easy to resolve... but I didn't used LUA for a long time...
I can't activate or deactivate a lightsource using the "dynamic name" of it, and I can't remember how to...?
this is the script :
the " print(name_of_the_light) " write the good string of the id of the light but it don't works with the deactivate function.
error : attempt to call method 'deactivate' (a nil value) X
please help me
sorry because probably my question is easy to resolve... but I didn't used LUA for a long time...
I can't activate or deactivate a lightsource using the "dynamic name" of it, and I can't remember how to...?
this is the script :
Code: Select all
function removetorchlight(self)
print("remove light")
local name_of_the_light = string.format("%s%u","torch_auto_light",self.id:sub(14,string.len(self.id)))
print(name_of_the_light)
name_of_the_light:deactivate()
end
error : attempt to call method 'deactivate' (a nil value) X
please help me