lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2013/2/24 Rena <hyperhacker@gmail.com>:
> On Sat, Feb 23, 2013 at 6:03 PM, Alfredo Palhares
> <masterkorp@masterkorp.net> wrote:
…
>> My question is:
>> Is there a KISS way to use the table like.
>> t.var = value
>> varibale = t.var
>>
>> And that will call the functions set and get?
…
>
> There is: the __index and __newindex metamethods. See
> http://www.lua.org/manual/5.2/manual.html#2.4
>

If you need more examples, see

<http://www.lua.org/pil/13.4.html>