lua-users home
lua-l archive

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


I would like to make an array of functions.  I tried the following syntax.

function steps[1] (a,b)
  print("steps[1]",a,b)
end

This yields the error message:

lua: test.lua:1: '(' expected near '['

If I write this instead, it works.

steps[1] = function (a,b)
  print("steps[1]",a,b)
end

Am I justified in expecting the first flavor to work?

 Thank you,
 Ken Smith