I’m setting a local dynamic variable name the following way
\_local["cracks"..brick.index] = ...
How than I can access the variable to do for example removeSelf? what I’ve tried
\_local["cracks"..brick.index]:removeSelf()
I’m setting a local dynamic variable name the following way
\_local["cracks"..brick.index] = ...
How than I can access the variable to do for example removeSelf? what I’ve tried
\_local["cracks"..brick.index]:removeSelf()
local tmp = \_local["cracks"..brick.index] tmp:removeSelf() tmp = nil
Syle Note: I wouldn’t use a variable named _local. Way too confusing and it will make searching your code a pain.
your solution is beating the purpose of using dynamic name variables in the first place…
Which brings up the question, what’s the purpose of “dynamic variable names,” as you’re calling them, in the first place? I’m curious what you’re trying to accomplish.
[lua]
_local[“cracks”…brick.index] = …
[/lua]
seems a roundabout way of writing something like
[lua]
local cracks = {}
cracks[brick.index] = …
[/lua]
local tmp = \_local["cracks"..brick.index] tmp:removeSelf() tmp = nil
Syle Note: I wouldn’t use a variable named _local. Way too confusing and it will make searching your code a pain.
your solution is beating the purpose of using dynamic name variables in the first place…
Which brings up the question, what’s the purpose of “dynamic variable names,” as you’re calling them, in the first place? I’m curious what you’re trying to accomplish.
[lua]
_local[“cracks”…brick.index] = …
[/lua]
seems a roundabout way of writing something like
[lua]
local cracks = {}
cracks[brick.index] = …
[/lua]