Help with parameter.text and a table.

If I have a parameter variable that is a string that holds user input. How can I use that string name to call the assosiated table?

parameter.text("tbl") --user typed "smoke"

smoke = {}
smoke.x = 5

tbl.x --I want to print the smoke table.

I was needing to do this for Particular Particle. However Having a bunch of tables with various names could lead to naming conflicts, so I changed my approach.

Although, this is great info to know. Thanks!

The loadstring function should do what you want :slight_smile:

    smoke.x = 5
        local f = loadstring("print("..tbl..".x)")

Edit: Then some inventive string manipulation for no hard coded bits :wink:

Edit 2: Some further info:

Totally didn’t think of that! Thanks.

Or you can access the _G table:

tbl = "smoke"
smoke = {}
smoke.x = 5

I think this would be faster than loadstring.

Ah nice! - now I totally didn’t think of that !