Difference between revisions of "Lua for Wii"

From WiiBrew
Jump to: navigation, search
m
m
Line 3: Line 3:
 
| title      = Lua
 
| title      = Lua
 
| type        = ported library
 
| type        = ported library
| author      = Feesh!
+
| author      = [[User:Feesh!|Feesh]]
 
| download    = http://feesh.braingravy.co.uk/archives/lua-wii.tar.bz2
 
| download    = http://feesh.braingravy.co.uk/archives/lua-wii.tar.bz2
 
}}
 
}}

Revision as of 22:15, 28 June 2010

Lua
General
Author(s)Feesh
TypePorted Libraries
Links
Download

Lua is a small and powerful scripting language that is perfect for use in projects that require changes in logic without the hassle of recompiling the program's source code. Lua can be told to load a file and execute functions from that file to create a dynamic program flow. Being extensible, Lua allows the programmer to define new functions for use in the script files they create.

Usage

The source code comes with a functioning example. To use the example, you need to copy the 'test.lua' to the root of your SD card, then run the lua.elf, either from Wiiload, the HBC menu, or (possibly- not tested yet) any other homebrew bootloader.

Build

Go to lua\lua-5.1.3 and type
make local
copy liblua.a to your lib directory and lauxlib.h lua.h lua.hpp luaconf.h lualib.h to your include/lua directory
add -llua to your makefile LIBS before lib math (-lm) because Lua depends on it (lmathlib.o and lvm.o objects).

note: If using the devkitpro release 19+, the toolchain executable has been rename from gekko to eabi, the src/makefile CC variable line 12 should be edited, as
it override the CC environement variable.

You may also change the line 19 to:
MYCFLAGS=-I$(DEVKITPRO)/libogc/include
as the fat lib is most likely to be part of libogc rather than devkitppc include dir

TheDrev 12:03, 9 April 2010 (UTC)

Reasons To Use Lua

To poke at a few popular uses of Lua; Lua was used in World of Warcraft for the GUI, in Farcry for the console system and all of the programmed user materials in Gmod(the famous retail HL2 sandbox mod) are made with it. It's been used in a bunch of open source game engines because it is simple to use and pretty versatile.

Bugs

  • FAT system needs to be initialized by the user before calling any file loading functions (such as luaL_dofile(...)).

Source

The only major changes to the source code were removing functions related to launching system executables and getting the system's time. Other small changes were made to the file manipulation functions- they try to initialize FAT before use but it is recommended you do this yourself! The makefile might need some configuration to reflect your development environment.

Wii Software using Lua