So i inserted a Value into a table with table.insert but when i want to print the value it is printing nil
local Filter = {
}
Filter.Filt = function(Character)
local test = "test"
table.insert(Filter, test)
print(Filter.test)
end
return Filter
Chrofex
(Chrofex)
#2
table.insert(Filter, test) will simply add “test” to the end of the array. In order to print the added value, you can do print(Filter[endOfArray])
Forummer
(Forummer)
#3
table.insert() inserts a value into an array, not a key/field which can be indexed via [] or the dot operator.
local Filter = {}
Filter.Filt = function(Character)
local test = "test"
Filter[test] = true
print(Filter.test) --true
end
return Filter