Reputation: 91
I want to do something like the following:
local archetype = "melee"
local meleeNames = { x,y,z }
if itemNumber > # [archetype .. "Names"] then
itemNumber = # [archetype .. "Names"]
end
However, I am not sure how to access the variable and this isn't it...
[archetype .. "Names"]
Thanks, Gullie
Upvotes: 2
Views: 122
Reputation: 7088
As @yu-hao said in his comment, you'can make up a syntax like that. You can use nasty tricks to have a similar effect, but that's not recommended. Instead do something like this:
local archetypes = { meleeNames = { x, y, z },
... others }
local archetype = "melee"
if itemNumber > #archetypes[archetype .. "Names"] then
itemNumber = #archetypes[archetype .. "Names"]
end
Upvotes: 5