lua-users home
lua-l archive

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

I am the new Javascript columnist for's email newsletter, with a monthly circulation of 2/3 million. I am using my second month's article for a little Lua evangelism. The following is my proposed article which I have to submit in the next couple of days; it must be 100-150 words and I'm near the very top already, so there won't be much I can add, though I could change things depending on feedback.

Thanks in advance, article follows:

GROKKING THE VIRTUAL MACHINE: This month we consider not Javascript, but it's syntactic cousin, Lua:

a = {}
a["b"] = "c"

This code is valid in both Lua and Javascript; the first line creates a Javascript "associative array", or in Lua, a "table". In both languages these constructs serve as "objects", so both of the following are valid statements for retrieving the "b" property of "a":


Other similarities include that functions are first-class values in both languages: they can be stored in variables, passed as arguments, and returned as results. Furthermore, both languages support "lexical closures", which allow "data hiding" (see last month's column).

Lua may well be the lowest-level of the C-based scripting languages: it is a "register-based" virtual machine, and has some hooks directly into C. It is popular both in Brazil where it originated, and with game programmers. Look into Lua, and become a better Javascript programmer!

Express yourself instantly with MSN Messenger! Download today - it's FREE!