ok... here is an example of what im trying to do:
MyTable = { }
local TableName = "MyTable"
table.insert(TableName, { "test" } )
is there a way to convert a string variable to a type that can be called as a table. because i keep getting this error:
attempt to index local 'TableName' (a string value)
TIA
-st0ne db
MyTable = { }
local TableName = "MyTable"
MyTable[TableName] = {[0] = "test1", [1] = "test2"}
QuoteOriginally posted by st0ne-db
ok... here is an example of what im trying to do:
MyTable = { }
local TableName = "MyTable"
table.insert(TableName, { "test" } )
is there a way to convert a string variable to a type that can be called as a table. because i keep getting this error:
attempt to index local 'TableName' (a string value)
TIA
-st0ne db
I better mention why the above doesnt work:
Syntax for table.insert:
*** table.insert(Table, Variable)
Table is the table to insert Variable to
Variable is the variable to insert into Table
So your example should be:
tMyTable = { }
local tTableToInsert = {[0] = "test"}
table.insert(tMyTable, tTableToInsert)
thanks so much for the great explanation... after using your suggestion everything works. thx again.