lua-users home
lua-l archive

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

	local helper
	helper = function()
		print (helper)

this code pattern is useful for recursive functions (calling helper
inside helper) and i use it all the time.

You can also write

	local function helper() print(helper) end

This is sugar for what you wrote above, so helper will be an upvalue (to the function itself) in the function body.