Something NEW?.....Naaa...Not much.

↑ Grab this Headline Animator

Wednesday 21 November 2007

Lua...

Lua...

Lua, pronouned as LOO-ah, is a lightweight, reflective, imperative and procedure language, designed as scripting language with extensible semantics as a primary goal.. The name derived from Portuguese word for MOON.

Lua was created in 1993, by the members of Computer Graphics Technology Group at Pontifical university of Rio de Janerio in Brazil. Lua has been used in many applications, both commercial and non-commercial.

Lau can be described as a mutli-paradigm language, providing a small set of general features that can be extended to fit different problem types, rather than providing a more complex and rigid specification to match a single paradim. Lua, for instance, does not contain explicit support for inheritance, but allows to be implemented relatively easily with metatables. Lua allows programmers to implement namespaces, classes and other related features using its single table implemenation; first class functions allow the employment of many powerful techniques from functional programming and full lexial scoping allows fine-grained information hiding to enforce the principle of least privilege.

Example code for Hello World:
print "Hello, World!"

Factorial in recursive function:
function factorial(n)
if n == 0 then
return 1
end
return n * factorial(n-1)
end

Lua supports closures, as
function makeaddfunc(x)
return function(y)
return x+y
end
end
plustwo = makeaddfunc(2)
print (plustwo(5)) --Prints 7

Nice? Want to learn more?... Lua...

No comments: