[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "static <type> <varname>;" like C in lua?
- From: Jorge <xxopxe@...>
- Date: Tue, 18 Mar 2014 01:13:55 -0300
On 18/03/14 01:04, meino.cramer@gmx.de wrote:
I am in search of a way to create a variable in the scope of a
function which is persistent i.e. does not loose it content over
several calls of its funtion. best regards, mcc
Something like this?
local function give_me_a_function ()
local foo = 0
return function()
foo = foo + 1
print(foo)
end
end
local f = give_me_a_function()
f()
f()