Game Development Reference
In-Depth Information
The MVC pattern discussed earlier holds true in this architecture. If we write our code with this in
mind, we can create not only cross-platform applications, but cross-framework ones. The controller
code that we write in Lua will change to cater for the other framework, but the rest of the code will
be the same.
In the next section, we shall focus on Lua and how to use it. After that, we'll look specifically at the
frameworks and integrate some of the things that you've learned.
Setting Up Lua
If we need to work with Lua, we need to have Lua. Since most of the frameworks use Lua 5.1.4, we
shall use that version for compatibility. Lua can be obtained as a precompiled binary or source code
www.lua.org/demo.html .
.
You can choose lua5_1_4_Win32_bin.zip or lua_5_1_4_Win64_bin.zip as per your version of Windows.
For the Mac, there are versions for Tiger, Leopard, Snow Leopard, and Lion.
For *nix, they are based on the kernel version; in this case, it's easier to download Lua from the app
catalog in each of the distributions.
iOS
There are two apps that I know of that allow for running Lua code interactively. Unlike the other Lua
offerings mentioned, these are not free.
iLuaBox : This app uses the newer version of Lua 5.2 and costs about $2.99 in
the App Store.
Lua Console : This app works with Lua 5.1.4 and costs $1.99 in the App Store.
Of the two, iLuaBox has some advanced functionality in terms of managing files and directories.
Features of Lua
Lua is implemented as a library written in C. It does not have a main program, as there is no need to
invoke something automatically; it works as in embedded mode and calls the embedding program.
This code can invoke other functions, assign variables, and read and write the data. Having been
written in C, it can also be extended; however, the official release will only add features that have
been approved by a committee.
 
Search WWH ::




Custom Search