lua-users home
lua-l archive

Re: Re: Antwort: global keyword instead of local

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


> do
> local vars = {x = 0}
> function a_function_that_uses_static_vars()
> %vars.x = %vars.x + 1
> return %vars.x
> end
> end
> 
> print(a_function_that_uses_static_vars())
> ==> 1
> 
> print(a_function_that_uses_static_vars())
> ==> 2
	The subject is changing dramatically. It starts with the
discussion about the global keyword...
	Well, my example was to show how to make a recursive call without
knowing the function's name.
	Tomas

AltStyle によって変換されたページ (->オリジナル) /