I'd like to be able to do this
local aoe_radius = userconfig[chosenconfig].radius --chosenconfig is a variable where value could be "small","normal" or "big" local aoe_damage = userconfig[chosenconfig].damage where userconfig array would something like:
local userconfig = {{name="small",radius="5",damage="50"}, {name="normal",radius="8",damage="100"}, {name="big",radius="15",damage="200"}} How do you access radius and damage of a given "name"?
I'd like to avoid writing it like this:
if chosenconfig == "small" then local aoe_radius = 5 local aoe_damage = 50 elseif chosenconfig == "normal" then ... end I'm new in Lua so I welcome redesign of above. Thanks.