Scripting support

Hello,this is a little bit complicated to explain,how do I transform a string value into a not string value?
Sorry if I didn’t explain myself,here an example;

local stuff = {
     apple = true
}
local el = "stuff" 
 --how do I transform el value (string) into the stuff table with all the children?

--In 3 words:how can I remove the "" of the string?
--[[Are there any vocabulary to help do that?
    like a reverse of the function tostring()
]]--

Sorry if I didn’t explain myself.

If you want variable el to equal the table above assigned to the variable named stuff, then you’d just need to assign el to that variable you created above it (stuff).

So el would be: local el = stuff. Notice how there are no quotes around “stuff”.

I’m not sure why you would do this unless you wanted to change the data inside el but still have the original data in variable stuff.

If you’re trying to set el to the dictionary stuff, just use local el = stuff.

That is more than 3 words. To remove the quotes, hover your mouse just to the right of each quote symbol, press down your left mouse button, and then press Backspace on your keyboard to remove the symbol.

yes everyone could do that,but my intention was to remove the quotes("") of the string WITHOUT doing it manually.

e.g.

local stuff = {
      thing = true;
}
local el = "stuff" 
--a function that transform el = "stuff" to el = stuff

yes everyone could do that,but my intention was to remove the quotes("") of the string WITHOUT doing it manually.

e.g.

local stuff = {
thing = true;
}
local el = “stuff”
–a function that transform el = “stuff” to el = stuff

You want to use the string and get the variable using the string?

yes,something like you said.

local stuff = {}
local el = "stuff"
--I need that the el = "stuff" with a function transform into el = stuff

To convert the string to a variable, you can use getfenv(), which stands for get function environment. It returns an empty dictionary, it can be used to get variables from the selected environment by indexing a string.

local name = "stuff"
local stuff = "Successful!"
local env = getfenv()
print(env[name]) --> Successful!
print(env.stuff) --> Successful!
print(env.something) --> nil

Oh,sorry if you didn’t understood me but I didn’t wanted to transform a string into a variable.
I needed a script or a vocabulary function that remove the blockquotes of a string.
e.g.

local el = "string"
--I want it to be transformed to
--el = string (as you see it's not longer a string and it doesn't have the blockquotes)

The string does not include the quotes, it’s just the word.

I mean the quotes before the string:

local el = " string "--this quotes,I want it to be removed with a script
--so it can be transformed to el = string
--the output should give me an error

Could you please explain what you need this for in the first place? I’m so confused on what you’re trying to do.

It’s too long to explain my project so I will make it short.
I need it for remove the quotes before and after a string:

local BigTable = {
     local smallerTable = {
            local text1 = {ar = "something"};
            local text2 = {ar = "something2"};
            local text3 = {ar = "something3"};
   };
        local smallerTable2 = {
            local text1 = {ar = "something"};
            local text2 = {ar = "something2"};
            local text3 = {ar = "something3"};
   };
}

function changeText(guy)
       local textN = "text" ..math.random(1,3)
       local  text =  "guy." ..textN..".ar" -- it will be something like
       --" BigTable.smallerTable.text1.ar"
       --I'm searching a way to transform text value into 
       --BigTable.smallerTable.text1

       -- "BigTable.smallerTable.text1.ar" transform to 
       --BigTable.smallerTable.text1.ar as you see it's not longer a 
       --string because it doesn't have quotes
end

changeText(BigTable.smallerTable)

Just split "smallerTable.text1.ar" into an array using string.split().
Then you have {"smallerTable", "text1", "ar"} (or never combine it into a string in the first place)

Then you can do something like this

local current = guy
for i = 1, #split -1 do --(skip the last key for below \/)
    current = current[ split[i] ]
end

current[ split[#split] ] = textN

If you don’t remove "guy." .. then you have to use getfenv() like bluebxrrybot said, but removing "guy." .. is better.