lua-users home
lua-l archive

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


Greetings to all.

I am an experienced programmer, but new to Lua.  We are exploring Lua for
possible use here at AEP.  Lua seems notable for its simplicity,
flexibility, speed and easy integration with C.  I have two small
questions.

First, in the Iterators Tutorial, it says:

    > function square(state,n) if n<state then n=n+1 return n,n*n end end
    > for i,n in square,5,0 do print(i,n) end

I thought I understood how "for" worked from reading the Control Structure
Tutorial and working some examples, but here I don't quite understand what
"for i,n in square,5,0" is doing.  It is not the same as "for i,n in
{square,5,0}," but what is it?  I don't see the general rule to which this
conforms.

Second, am I right that there exists no Lua interface to HDF5 or to netCDF
(these are formats for scientific data)?  I doubt that it would be
difficult to build one, but I don't want to bother doing this if someone
has already done so.

I would just like to conclude with a non-expert observation. Python (or
Perl or Ruby) is said to be more useful than Lua as a general-purpose
scripting language, due to its larger community, more extensive
documentation, and more ample libraries.  But in each case, the imbalance
seems likely to change with time.  It therefore seems to me that Lua has
some potential to compete with Python not merely as an embedded language,
but for general use as well.  I don't see anything in Lua's architecture
that would prevent this.

Mark F. Morss
Principal Analyst, Market Risk
American Electric Power