lua-users home
lua-l archive

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


>From my understanding of this code, adding this code to the begining of a
>script should be all I need?

Yes. Except that
	rawgetglobal(x)
should now be
	rawget(globals(),x)

(Sorry, the FAQ needs updating...)

>x = 10
>
>This should cause the function safe_getglobal to be run, because of the
>assignment to global x?

No.  It's "get" not "set". Try "print(x)" instead.

For a different technique, see '"Global" keyword' in
	http://lua-users.org/wiki/NamespacesAndModules
--lhf