So I wanna get this table value as a variable but it doesn’t work.
local Table = {}
local InsertedValue = table.insert(Table,"Test")
table.remove(InsertedValue,table.find(Table,InsertedValue))
“InsertedValue” is nil
So I wanna get this table value as a variable but it doesn’t work.
local Table = {}
local InsertedValue = table.insert(Table,"Test")
table.remove(InsertedValue,table.find(Table,InsertedValue))
“InsertedValue” is nil
InsertedValue shouldn’t be a variable because that’s the function of inserting “Test” inside the table which doesn’t return anything. You can instead do this:
local Table = {}
table.insert(Table,"Test")
table.remove(Table,table.find(Table,"Test"))
Yea I already know that but I plan on having multiple values in one table which will be called “Test” for some reasons so I wanna be able to single this out
Gotcha are you trying to do something like this:
local Tab = {}
local function InsertValue(Value)
table.insert(Tab, Value)
return Tab[table.find(Tab,Value)]
end
local InsertedValue = InsertValue("Test")
local AnotherInsertedValue = InsertValue("Test")
Is this correct?
You can’t save table descendents as variables because you call them as table[index], but you can find variables by using table.find() if you wanna retrieve the value again.