lua-users home
lua-l archive

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


Just a thought... Now that Lua has "for" loop, wouldn't it be nice
if they could be used in a manner similar to (or even instead of)
foreach() and foreachi()?

foreachi is perhaps not that interesting, since

  for i = 1,getn(list) do

seems simple and logical enough... I guess I just like the Python
syntax

  for i in list

or

  for key, val in dictionary

Something like that would of course require another keyword,
which is probably not desirable...

--

  Magnus Lie Hetland      (magnus at hetland dot org)

 "Reality is what refuses to disappear when you stop
  believing in it"                 -- Philip K. Dick