lua-users home
lua-l archive

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

Best way I can think to explain/show this is code:

  k = {read = function() print("hi") end }
  t = {s = function() return k end }

That produces an error:

4: attempt to call a nil value

If you append a semicolon to the end of line 3 however (forcing the end of the statement?), the error is fixed.

I'm guessing this is a bug because, as I understand it, semicolons are optional and only intended as syntactic sugar.

I can see that the third statement is trying to use (t:s()) as function arguments. I have a feeling this isn't intended but maybe I'm wrong.

-Patrick Donnelly

"One of the lessons of history is that nothing is often a good thing to do and always a clever thing to say."

-Will Durant