Friday, September 14, 2007

LUA programming language gaining popularity

In the previous log, I mentioned the programming language, Lua.

Lua came to my attention because its rank on the TIOBE Programming Community Index
for September 2007 is 18th (up from rank 50 this time last year!!!).

Lua is a no-cost programming language distritubed under the very liberal MIT license.

It is a small, no-frills procedural scripting language that boasts a fast speed.

It is designed with great flexibility, and a programmer can add functionality (such as object orientation) with only a little extra effort. According to a Lua tutorial, objects (data and code encapsulated together) can be created with Lua tables, and inheritance can be achieved with metatables.

I downloaded a Lua binary for Windows at:

http://luabinaries.luaforge.net/download.html

I got a small, 142,512 byte file, lua5_1_2_Win32_bin.zip

De-archived, this file produced:

36,864 bin2c5.1.exe
114,688 lua5.1.dll
20,480 lua5.1.exe
122,880 luac5.1.exe

I modified a few lines of code from the wikipedia entry for Lua and put it in a script file named, "hello.lua"
-------------------------------------------
print "Hello, World"

function factorial(n)
if n == 0 then
return 1
end
return n * factorial(n - 1)
end

print(factorial(4))
------------------------------------------

I ran it from the directory containing the Lua exe:

C:\ftp\lua5_1_2_Win32_bin>lua5.1.exe hello.lua
Hello, World
24

It worked!

I don't know enough about Lua to recommend or reject it, but it seems to be a neat little scripting language.

A Google search (Lua tutorial) will retrieve many resources.

-Jules J. Berman
Science is not a collection of facts. Science is what facts teach us; what we can learn about our universe, and ourselves, by deductive thinking. From observations of the night sky, made without the aid of telescopes, we can deduce that the universe is expanding, that the universe is not infinitely old, and why black holes exist. Without resorting to experimentation or mathematical analysis, we can deduce that gravity is a curvature in space-time, that the particles that compose light have no mass, that there is a theoretical limit to the number of different elements in the universe, and that the earth is billions of years old. Likewise, simple observations on animals tell us much about the migration of continents, the evolutionary relationships among classes of animals, why the nuclei of cells contain our genetic material, why certain animals are long-lived, why the gestation period of humans is 9 months, and why some diseases are rare and other diseases are common. In “Armchair Science”, the reader is confronted with 129 scientific mysteries, in cosmology, particle physics, chemistry, biology, and medicine. Beginning with simple observations, step-by-step analyses guide the reader toward solutions that are sometimes startling, and always entertaining. “Armchair Science” is written for general readers who are curious about science, and who want to sharpen their deductive skills.