lua-users home
lua-l archive

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

On second thought, here is a better solution:

 local T={x=10,y="lua"}

 function Set(x,y) %T.x=x %T.y=y end
 function Get() return %T.x,%T.y end

The idea is to save all "static" variables as fields in T.
Then, any functions can communicate via T.
And each chunk can have its own pritave tables of statics.
When the chunck ends, the variable is gone but not its value!