lua-users home
lua-l archive

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


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