Reputation:
I want to set dynamic variable names.
such as
function make(name)
local name..bar = "ipsum"
end
make(foo)
this possible?
Upvotes: 0
Views: 192
Reputation: 9559
For globals it's simply indexing like _G[name..bar]
. For locals you could emulate this by setting all globals you use in a local table, and index that one. For an approach to really use a local, I can't help you.
Upvotes: 2