Back to index




Welcome to DSLua

DSLua is a port of the Lua scripting language to the Nintendo DS. Originally made by waruwaru, now maintained by sypherce, daltonlaffs, and me, Jeremysr. You can get it or the source code from DSLua.com, on the download page. This document will explain how to use DSLua and write programs for it.




CF Flavour

DSLua comes in two flavours: CF flavour, and GBFS flavour. This section will explain the CF flavour.

The CF flavour is a single DS executable that you can run on your DS. When run, it opens a file browser. You can browse through your storage card, press A to run lua programs (highlighted in green.)

The CF flavour comes in 3 more versions: blue, green, and gray, like DSOrganize. Blue will be the best choice for Supercards, green will work best for M3 devices, and gray will work for most other devices. If none of them work, you may have to use DSLua GBFS flavour.





GBFS Flavour

The GBFS flavour packs your lua files (and graphics, music, sound effects, whatever you need to run your program) into a single DS executable, so you don't have to have all the lua files on your storage device, like in the CF flavour.

To pack the files, you must first put your files in the scripts directory (found in the main directory of DSLua GBFS flavour). Then, run PACK.BAT. It should put all the files from the scripts directory and pack them into bundle/DSLUA-PACK.nds (or .ds.gba or .sc.nds). Then you run whichever one is compatible with your homebrew device, and when run it will let you choose a packed file to run (lua files will be highlighted in green.)




Auto-start

The Auto-start feature lets you make a DSLua file that will automatically run a certain file on the storage device (or GBFS). See auto-start.bat for instructions and an example.




gfx2gba

Currently your game sprites must be in .raw/.pal format, and your backgrounds must be in .raw/.pal/.map format. To convert them, use gfx2gba.exe which is found in the bin directory. From the command line, run this to make a sprite:

gfx2gba -poutput.pal input.bmp


The output will be a palette file (output.pal) and a raw image file with the same name as your input (in this example it would be input.raw). The input file must be a 256-colour bitmap (.bmp). Its width and height must be 16, 32, or 64 pixels. (Examples: 16x16, 32x64, 64x16...)

To make a background (tile map), you need to add -m to the command:

gfx2gba -m -poutput.pal input.bmp


With this example it will output three files: input.raw, input.map, and output.pal. Like sprites, the input bitmap must be 256 colours and the width and height must be in multiples of 8.




More Information


Back to index