I have a clients table that I bypass using pairs . Also, I use two methods: add and del . How to ignore these methods without inserting a check on whether it is a function?
1 answer
Use metatables:
clientops = {}; -- В эту таблицу пишите методы clients = setmetatable({}, {__index = clientops}); -- Назначить таблицу методов Now add methods for clients in clientops (when called through : first parameter is the clients anyway).
- a small example of use would not hurt at all, as it seems to me. - aleksandr barakin
- @alex, in fact, is from my practice, but I'll try to make an example. - val
|