Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am under the impression that Lua is widely used for video games.


Lua is often used as an embedded scripting language within level editors, for example to keep track of the progress made on a quest or to trigger an event when the character reaches a certain point. Lua isn't used to code the game engine itself (in the vast majority of cases, there may be some obscure examples of game engines written in Lua)


Right - The stuff that needs high performance or low-level access (e.g. graphics code) is written in C or C++, but most of the "soft layer" is scripted in Lua.

See: http://www.c2.com/cgi/wiki?AlternateHardAndSoftLayers


You need some LÖVE!

http://libregamewiki.org/LOVE

"LÖVE is a cross-platform, 2D game engine. The latest version of the engine is 0.5.0 released on September 9th, 2008.[1] It uses the SDL library, OpenGL hardware acceleration and the Lua programming language to program games.[2] It is licensed under the Zlib license. "


Much of World of Warcraft's user interface is written in Lua, and I'm not sure I'd classify WoW as an obscure example.


But the game engine is not. It doesn't use LUA to push polygons.


That is correct, but the game does use it for a lot more than just scripting.

ps: Lua, not LUA -- it's the Portuguese word for moon, not an acronym :)


So we can conclude then that games have many different facets to them and they can be loosely coupled enough that you can implement them using different technologies. The interface could be done in Lua, since it doesn't require intense computations when compared to graphics and physics engines.


Lua is pretty popular because it is a simple scripting language that you can either run in an interpreter, or compile to C. The interpreter is easily embeddable, and you can call C functions from it. All of this makes for pretty rapid development without sacrificing speed for the things that it is suitable for.


Just a nitpick - Lua doesn't compile to C, but rather to Lua VM bytecodes that can be embedded as data in C code.

Lua strikes me as a much nicer interface to C libraries.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: