lua-users home
lua-l archive

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


This code works:
--------------------------------
$debug

myFunc = function () 
  Test = {}
  Test.init = function (self) end
end
--------------------------------

This code doesn't:
--------------------------------
$debug

myFunc = function () 
  Test = {}
  function Test:init() end
end
--------------------------------

Lua says:
  lua error: `end' expected (to close `function' at line 3);
  last token read: `function' at line 5 in file `test.lua'

Am I doing something wrong or is this a bug in Lua?
I thought "a:b()" was syntaxical sugar for "a.b(a)"(?)

Steve