tags:

views:

925

answers:

7
+5  Q: 

Lua, what is Lua?

Hi all?

I read something about Lua this day, and I was wondering what it was. I did a Google and Wikipedia (I understanded it until they begun talking about a C API) search bit I still don't understand it. Can someone explain me what Lua is and maybe even a tutorial for beginners?

Thanks in advance!

+15  A: 

Lua is a lightweight interpreted programming language developed in Brazil with a focus on embedding.

It is written in Pure ANSI C which means high portability, even as C++ code.

Here is an example:

print("Hello World!")

Wikipedia Summary

Official Site

Unknown
I'd add that mainstream games like crysis use it for scripting.
Tamás Szelei
Don't forget World of Warcraft! Armies of Lua hackers have been birthed due to that game.
Stuart Branham
+7  A: 

Lua is a scripting language for C and C++. It allows to use the simpler syntax of Lua and execute these scripts in your C/C++ application. Therefore you don't have to compile the program on each change, but simply deliver a new script version.

For tutorials just use google, you'll find enough to keep you busy the next days.

DaClown
I'dd add to that that it allows to quite easily invoke the C code (don't know about C++, never did it myself, so maybe) from your Lua script. Also it's tiny and quite fast. Which makes it an ideal "glue" for an application. Oh, and it is a perfect config file parser (if you don't import any functions into the interpreter context that you use for parsing the config files).
Andrew Y
It's not only for C/C++. The Lua runtime can be used from other languages as well, and there are implementations other than the official one. Lua itself is technically not bound to C or C++.
OregonGhost
+3  A: 

Lua is a scripting language. Link is to lua.org. It is heavily used in game development, most notably (to me) World of Warcraft.

Paul Williams
why the -1?
Javier
I wonder if someone thought I worked for Blizzard. I do not. I just played and enjoyed the game for a long, long time. On the other hand, quitting has been the best thing for my life. /shrug
Paul Williams
I gave you +1 for the awesomeness of your answer!
Mark
+4  A: 

Lua is a lightweight, embeddable scripting language. It's garnered a lot of popularity partly due to it's use in many popular games. A good example of this is World of Warcraft which uses an embedded version of lua to drive the behavior of the UI elements in the game.

A good intro to the language can be found here: http://computer-programming-languages.suite101.com/article.cfm/a_brief_introduction_to_lua_scripting

And the official online reference for the language can be found here: http://www.lua.org/manual/5.1/

Dan Rigby
+2  A: 

It's a scripting language that is designed to work with C (and C++). It is designed to be embedded into C/C++ programs. Which means unlike a lot of other scripting languages, it makes no use of global variables and such, this means you can easily thread lua scripting engines.

It also makes claims about being the fastest dynamic scripting language.

I've made use of it in PC based C++ application for creating a plugin scripting interface, and also used it as a embedded scripting language. Its quite versitile, nice and small.

as a general purpose scripting language? Its not quite in the same league as your ruby/python/perl type stuff. It doesn't have as many libraries and the user community is pretty small.

But for extending C++/C apps? its awesome.

Keith Nicholas
+7  A: 

I'm surprised everyone is getting this one wrong. Lua is the Hawaiian word for "toilet".

Kip
+1 for the funny.
ceretullis
A: 

Also is the Local User Administrator account in Windows.

Booter
Close, and then only when misspelled as an acronym. The language is Lua, named after the Portuguese name of the Moon. Least User Access is a Microsoft name for a design pattern that encourages the (good, IMHO) practice of programs being capable of working correctly when used by normal unprivileged users.
RBerteig