0

I want to set dynamic variable names.

such as

function make(name)
local name..bar = "ipsum"
end

make(foo)   

this possible?

1
  • Can you give an example of why you would want to do this? Commented Oct 15, 2011 at 21:20

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.