> $ cat fr.lua
>
> file = io.read("*all");
>
> print("I read the whole file")
>
> print("Converting the file to upper case and writing")
>
> o = string.lower(file)
>
> print("Method 1:")
>
> io.write(o)
>
> print("Method 2:")
> file:lower()
>
> io.write(o)
>
> I will explain tomorrow after you do your testing and thinking.

This is my tomorrow in case you are reading this from India. ;)

Anyway you run this code like this:

$ lua fr.lua < /tmp/somefile.txt

This is important. If you just give the file name it will wait and do nothing.

This code will convert the file into lower case and print in two different ways.

Lua like python has plenty of string manipulation functions built into
the standard
 library itself.

Lua has excellent support for perl like modules and already people have made
available several Lua Rocks which you can use.

I hope to write one within a year or so.

The way I see it, lua has several built in conveniences of python or
Tcl and other
 scripting languages, it has the power and depth of perl being so
closely melded with
 C.

In the next few weeks we will naturally be able to see its power and beauty.

I find it quite boring that I cannot spot the os interface for several
functions that
 are common in languages.

C API like

pwd
chroot
copy
move

and so on are missing.

Or I am not looking properly.

There is however a os.execute().

Anyway we will get there step by step.

-Girish

-- 
Gayatri Hitech
http://gayatri-hitech.com
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to