Hi, I want to call function after __newindex called, but I have error “delay in metamethod”, cus I use wait() in function, I tried add coroutine to __newindex, but this not helpful. P.S: I can use bindable event, but I want better way to make this.
Example of what I do:
local Table = {}
setmetatable(Table,{
__newindex = function(self_table,index,value) -- also when I "print(Table)" index is not exist.
wait(1) -- error, cus I use delay
print("Index is:"..index)
end})
Table["test"] = "k"
local Table = {}
setmetatable(Table,{
__newindex = coroutine.wrap(function(self_table,index,value) -- also when I "print(Table)" index is not exist.
wait(1) -- error, cus I use delay
print("Index is:"..index)
end)()})
Table["test"] = "k"