lua-users home
lua-l archive

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


On Mon, Jul 29, 2013 at 2:43 PM, Marius Booysen <tuppe99@gmail.com> wrote:
Do all functions need to be complete before I can call it in Lua?

They must be defined before they are used, yes. But you can do forward declarations if your functions call other functions:

local f,g

function g () return f() end

function f () return 10, 12 end

a,b = g()
print(a,b)

'local function f() .. end' is short for 'local f; f = function()...end' remember!

steve d.