lua-users home
lua-l archive

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


> Is there a way, in 5.2, to identify these 'global global' through byte code analyses? In the same way one could clearly and easily identify global access by checking for ([GS])ETGLOBAL in 5.1?

No because what used to be globals in 5.1 are now free names in 5.2 and
access to these is rewritten via _ENV.
 
> I suspect not? oh, well? so much for global checker I guess...

Perhaps if you want to make it strict but in practice static analysis
does work for ordinary program that do no mess explicitly with _ENV.

OTOH, even in 5.1 one could play obscure games like
	local a="var"
	_G[a]=42
and this may or may not be an access to the global var, depending on
what _G holds. (Recall that _G is not a reserved name and can hold any
value.)