[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Various questions
- From: "ggrothendieck" <ggrothendieck@...>
- Date: Fri, 19 Apr 2002 17:53:46 -0000
I have started with lua and have a few questions:
1. Read input, process loop with field splitting
------------------------------------------------
Currently I am doing something like the following:
-- print first field of each input record
while 1 do
l = read("*l"); if not l then break end
f = split(" \t", l)
print( "<" .. f[1] .. ">" )
end
where split is found in the Reuben library that I found on the net.
Is there some way to streamline this some more? In awk its implicit
and is nearly so in perl so I thought perhaps I missed something.
2. global
---------
I too would like to see this considered further before putting it
in the language. It seems complex and error prone to me foiling
the simplicity of lua.
We should consider how other languages accomplish its intent.
I have one idea in this regard although I am not sure how good
it is. One poster suggested that global might be OK since it would
likely be used just by power users. If this were the case perhaps
all features should be divided into two sets and if you wanted to
access the more complex set then you would have to declare your
intention in some sort of declaration statement.
Code which did not have this declaration statement would be
guaranteed to be simple.
3. Search path
--------------
Right now I issue the following command to run lau 4.0 from
Windows 2000:
lua reuben.l -f test.l
where reuben.l is a text file with the functions in Reuben's
proposed library. I found them on the net. Is there a search
path facility in lua so that I can put reuben.l and other libraries
I might find or create and not have to worry about where it is
located on my system?