GBALua API [top]
Listed below are all the functions available from from the lua code. Most of them handles different kinds of memory operations that is usefull for a wide range of things from copying graphics data to setting registers. The library of memory related functions might be enhanced in the future. The functions names should pretty much explain what each of these functions does. The notation of 8. 16 and 32 is to indicate how big writes or reads the function does each time.
There are also a few other functions that can be used. The Hex( ) function takes a string formated as a value and returns a that value as a number. If the string begins with the letters '0x' the string will be treated as it was a hexidecimal value. Kind of usefull.
The assert( ) function takes a number and a string. If the number is not zero, the program will stop and display the string togeter with the number. This can be very helpfull when debugging your program. However, if the number was not a zero value, the function will never return.
The StrLen( ) function takes a string and returnes the length of the string. NumToStr( ) takes a number and returns is as a string, usefull when printing values to the screen for example. StrCopy( ) is a kind of specialized MemCopy function that can be used for fast printing of letters on the screen.
The functions starting with a b (band, bor and bxor) all maps to functions that performs a binary operation on two values (and, or and xor respective).
Ok, I know it's not much but it's atleast something. There should probably be loads of more functions, but yet I've found these functions to do most of the work. If you think that some functionallity is missing that you really would like to have added, fell free to mail me. And if you are lucky, I will even get around adding it...
GBALua Tools [top]
There are a couple of tools included within the GBALua suite. All of the tools should show some help if called without any parameters.
PCX2Agb was originaly supposed to ba called PCX2Gba but there was allready a tool called that. It is used for exporting graphics data from an .pcx-file into more suitablle format for the GBA. This tool was made when I started developing a game (not released, but still working on it). I've modifed to tool a little bit so that it now can export data into binary files used by GBALua aswell of ordinay c- and header-files. Currently it lacks a few features, such finding flipped and mirrored tiles. However, everything is not bad about it, since it handles both 16 and 256 color tiles/sprites, invert palettes, include empty tile, handles bitmapped modes, export to binary files or c/header files and export a new pcx-file with all the tiles in it.
Not written by me. This is a tool that comes with the real lua-suite, available from www.lua.org. This tool takes lua files and precompiles them into byte code. However, this tool is not needed since lua can execute both precompiled byte code and ordinary lua source-files. Therefore, this command:
LuaC -o LuaCode.bin -s LuaSource1.lua LuaSource2.lua
can be replaced with:
copy /B LuaSource1.lua+LuaSource2.lua LuaCode.bin
Both these solutions will produce a file called LuaCode.bin that can be used later by GBALuaCore. The difference is that the copy procedure will make a slightly smaller file but will probably execute somewhat slower.
This tool takes different files and appends them to a masterfile. Basicly it just adds a small header directly after the masterfile and then the files. Then, when the newly created GBALua application executes it will read in all these data and register the names in the lua environment. The name will be the same as as the filename without the extension and will point to the acctual filedata. Also a symbol for how big the file is will be registerd as [filename without extension]_SIZE. There is only one quirk with this tool and that is the -mb switch. If this switch is added, the output file will be exactly 256 kb big, with the appended header and files at the end of this big file. It is done in this fashion so that the heap will not overwrite the appended data. Note that the different versions of GBALuaCore (the multiboot one and the regular one) search for it's appended data at respective place, so use the -mb switch visely.