[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Emulate setters and getters on table
- From: Alfredo Palhares <masterkorp@...>
- Date: Sun, 24 Feb 2013 00:03:30 +0100
Hello Lua-l wizards,
I do not have much experience with lua, so here it goes my question:
local t = {}
local var
local function getVar()
-- do some loic here
return var
end
local function setVar(value)
-- do somelogic to value
var = value
end
return t
On another file
local t = requite("t.lua")
t.setVar(somevar)
-- And so on.
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?
Thanks for your time.
--
Regards,
Allfredo Palhares