CtruLua 3DS

From GameBrew

ctrµLua
Ctrulua2.png
General
AuthorFirew0lf, Reuh, Negi
Last Updated2016/11/27
TypeGame engine
Version1.0
LicenseMixed
Links
[1.0 and CI server Download]
Website
Source

ctrµLua is a Lua parser for 3DS. It's born within the µLua community as an attempt to bring their favorite piece of software to the 3DS. The result ended being mighty different from what was µLua itself.

With the latest release, ctrµLua supports all the most common features needed to create a 2D game or app.

Features

  • HID (everything).
  • 2D graphics.
  • 3D support (with 2D graphics).
  • Texture loading and saving (PNG, JPEG, BMP, a lot of other formats).
  • Fonts (TTF, a lot of other formats).
  • Maps (.csv).
  • Sound (WAV and OGG with/without streaming).
  • Sockets (TCP and UDP).
  • HTTP contexts (with/without SSL).
  • Infrared communication (untested on hardware).
  • UDS services (local wireless communication).
  • Filesystem.
  • LZLib (zlib compression).
  • ROMFS.
  • Camera.
  • Microphone.
  • Threads.
  • PTM services.
  • Head tracking.
  • APT services.
  • User and system informations.
  • News.

Installation

Installing

Unzip ctrµLua on your SD card, in a folder inside your homebrews folder; if you use HBL, extract it in /3ds/ctrulua/

Put some scripts wherever you want, just remember where.

Launch CtrµLua from your Homebrew Launcher, then use the shell to run your scripts.

Building

Setup your environment as shown here.

Clone this repository and run the command make build-all to build all the dependencies.

If you only made changes to ctrµLua, run make to rebuild ctrµLua without rebuilding all the dependencies.

Note: May not work under Windows.

User guide

Hello world

local ctr = require(""ctr"")
local gfx = require(""ctr.gfx"")
local hid = require(""ctr.hid"")

while ctr.run() do
 hid.read()
 local keys = hid.keys()
 if keys.held.start then break end
 
 gfx.start(gfx.TOP)
  gfx.text(2, 2, ""Hello, world !"")
 gfx.stop()
 
 gfx.render()
end

This script will print "Hello, world !" on the top screen, and will exit if the user presses Start.

This is the "graphical" version; there's also a text-only version, based on the console:

local ctr = require(""ctr"")
local gfx = require(""ctr.gfx"")
local hid = require(""ctr.hid"")

gfx.console()
print(""Hello, world !"")

while ctr.run() do
 hid.read()
 local keys = hid.keys()
 if keys.held.start then break end
 
 gfx.render()
end

gfx.disableConsole()

Lua API Documentation

  • An online version of the documentation can be found here.
  • To build the documentation, run make build-doc-html (requires LDoc).

Changelog

v1.0 Build f118baa

  • Sprite library.
  • Configurable filepicker.
  • Shell to select and launch scripts.
  • Configurable keyboard library.
  • Text editor with Lua syntax highlighting.
  • Code examples.

Release notes.

Credits

External links