lua-users home
lua-l archive

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


On Fri, Oct 9, 2009 at 2:32 PM, steve donovan <steve.j.donovan@gmail.com> wrote:
> Lua order is pretty flexible, though you do have to declare local
> functions up front as locals...

Global functions, too, I noticed. I'm kinda surprised, since there is
always a compilation step before execution. (But I'm still very
ignorant of Lua's implementation.)


fire()
local function fire() print('foo') end

lua: test.lua:4: attempt to call global 'fire' (a nil value)
stack traceback:
	test.lua:4: in main chunk
	[C]: ?


fire()
function fire() print('foo') end  --global

lua: test.lua:4: attempt to call global 'fire' (a nil value)
stack traceback:
	test.lua:4: in main chunk
	[C]: ?


Oh well. I'm still digging it. Sorry to stray off topic.