Is it possible in lua to override access to table element?
F.e. I have a Lua table TBL = {A=1, B=2} and I want to call some function when I use TBL.A instead of getting real TBL.A value.
Is it possible in lua to override access to table element? F.e. I have
Share
You can use metatables to catch accesses to non-existing elements and several other operations. However, there is no way to directly catch accesses to existing elements, you should build a proxy over your table.
You can check this proxy implementation to see how it works and adapt it to your needs.