lua-users home
lua-l archive

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

2012/6/4 Axel Kittenberger <>:

> Yes, I'm convinced, implicit locals are a bad thing, but I never
> really got why we need an implicit anything, I know one can hack _G
> but anyway, never understood why someone thought implicit globals are
> a good thing to begin with. It does require some deeper experience
> into the language to hack it away again.

I've attached a solution, slightly modified from `strict.lua`.
Sample session:

$ lua
Lua 5.2.0  Copyright (C) 1994-2011, PUC-Rio
> require"fascist"
> a=1
stdin:1: assign to undeclared variable 'a'
stack traceback:
	[C]: in function 'error'
	./fascist.lua:25: in function '__newindex'
	stdin:1: in main chunk
	[C]: in ?
> global{a=1,b=2}
> b=3
> liberate()
> x=10

Attachment: fascist.lua
Description: Binary data