Description of the functions provided by MicroLua as of version 4.7.1.
The variables or functions that you will find here may be defined either in the Lua libraries (libs tag) or in the C code (nds tag).
Some are also tagged as deprecated, or as unused because you are not meant to access them directly.
ULUA_VERSION
(nds): version of Micro Lua as a String; usually of the form MicroLua X.X.XSCREEN_WIDTH
, SCREEN_HEIGHT
(nds): width and height of the screensNB_FPS
(libs): number of frame per second automatically updated every secondRAM
and VRAM
(nds): destination where to load some object; see examples for more detailsATTR_X1
, ATTR_Y1
, ATTR_X2
, ATTR_Y2
, ATTR_X3
, ATTR_Y3
, ATTR_COLOR
, ATTR_COLOR1
, ATTR_COLOR2
, ATTR_COLOR3
, ATTR_COLOR4
, ATTR_TEXT
, ATTR_VISIBLE
, ATTR_FONT
, ATTR_IMAGE
(nds): attributes used in canvasALPHA_RESET
(nds): blending coefficient value to reset alpha transparency; is equal to 100PLAY_LOOP
, PLAY_ONCE
(nds): arguments to play mods respectively loop and onceLED_ON
, LED_BLINK
, LED_SLEEP
(nds): blink modes for the LED (always ON, blinking fast, blinking slow)ULUA_DIR
: /lua/ (main directory of µLua)ULUA_SCRIPTS
: ULUA_DIR scripts/ (default folder for scripts)ULUA_LIBS
: ULUA_DIR libs/ (default folder for libraries)ULUA_BOOT_FILE
: boot.lua (first loaded file)ULUA_BOOT_FULLPATH
: ULUA_DIR ULUA_BOOTFILE (full path of the first loaded file)System.EFS
(nds): tells whether an Embedded File System is includedmustCountFPS
(libs, unused): regulate the FPS counting system; it is an internal variable, you should never have to deal with itDebug.isDebugOn
, Debug.debugText
and Debug.debugColor
(nds, unused): variables used by the debug system; you should only modify them by using the Debug functionsVoid render()
(libs)
Refresh the screen.
Void startDrawing()
, Void stopDrawing()
(libs, deprecated)
All your drawing instructions must be between these two functions.
Void screen.switch()
(nds)
Switch the screens.
Number screen.getLayer()
(nds)
Get the current layer.
Number screen.getAlphaLevel()
(nds)
Get the current transparency level.
Void screen.setAlpha(level[, layer])
(nds)
Set the transparency level for the given layer.
level
(Number): blending coefficient, between 0 and 99 (100, that is to say ALPHA_RESET, reset all the transparency system)layer
(Number): layer to set; the function however automatically keeps the count so you don't have to give and layerVoid screen.print(screen, x, y, text [, color])
(nds)
Print a text on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x
(Number): x-coordinate where to drawy
(Number): y-coordinate where to drawtext
(String): text to printcolor
(Color): color of the textVoid screen.printFont(screen, x, y, text , color, font)
(nds)
Print a text on the screen using a special font.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x
(Number): x-coordinate where to drawy
(Number): y-coordinate where to drawtext
(String): text to printcolor
(Color): color of the textfont
(Font): special fontVoid screen.blit(screen, x, y, image, [, sourcex, sourcey] [, width, height])
(nds)
Blit an image on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x
(Number): x-coordinate where to drawy
(Number): y-coordinate where to drawimage
(Image): image to blitsourcex
, sourcey
(Number): coordinates in the source image to drawwidth
, height
(Number): width and height of the rectangle to drawVoid screen.drawPoint(screen, x, y, color)
(nds)
Draw a point on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x
(Number): x-coordinate where to drawy
(Number): y-coordinate where to drawcolor
(Color): color of the pointVoid screen.drawLine(screen, x0, y0, x1, y1, color)
(nds)
Draw a line on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x0
, y0
, x1
, y1
(Number): coordinates of the linecolor
(Color): color of the lineVoid screen.drawRect(screen, x0, y0, x1, y1, color)
(nds)
Draw a rectangle on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x0
, y0
, x1
, y1
(Number): coordinates of the rectanglecolor
(Color): color of the rectangleVoid screen.drawFillRect(screen, x0, y0, x1, y1, color)
(nds)
Draw a fill rectangle on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x0
, y0
, x1
, y1
(Number): coordinates of the rectanglecolor
(Color): color of the rectangleVoid screen.drawGradientRect(screen, x0, y0, x1, y1, color1, color2, color3, color4)
(nds)
Draw a gradient rectangle on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x0
, y0
, x1
, y1
(Number): coordinates of the rectanglecolor1
, color2
, color3
, color4
(Color): colors of the rectangleVoid screen.drawTextBox(screen, x0, y0, x1, y1, text [, color])
(nds)
Draw a text box on the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x0
, y0
, x1
, y1
(Number): coordinates of the text boxtext
(String): text to printcolor
(Color): color of the text boxVoid screen.drawTexturedQuad(screen, x0, y0, x1, y1, x2, y2, x3, y3, texture[, sourceX, sourceY][, width, height])
(nds)
Display a textured quadrilateral.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x0
, y0
, x1
, y1
, x2
, y2
, x3
, y3
(Number): coordinates of the quadrilateral anglestexture
(Image): texture imagesourcex
, sourcey
(Number): coordinates in the texture image to drawwidth
, height
(Number): width and height of the texture image piece to drawVoid screen.drawTexturedTriangle(screen, x0, y0, x1, y1, x2, y2, texture[, sourceX, sourceY][, width, height])
(nds)
Display a textured triangle.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)x0
, y0
, x1
, y1
, x2
, y2
(Number): coordinates of the triangle anglestexture
(Image): texture imagesourcex
, sourcey
(Number): coordinates in the texture image to drawwidth
, height
(Number): width and height of the texture image piece to drawBoolean screen.getMainLcd()
(nds)
Give the screen the µLibrary is drawing on (true for upper screen, false for the lower screen).
Void screen.setSpaceBetweenScreens(space)
(nds, deprecated (you can no longer draw on the two screens at the same time))
Set the space between the screens (so some drawing will not be displayed if drawn in this space).
space
(Number): space (in pixels) between the screensVoid screen.init()
(nds, unused)
Initialise some stuff about the screens. It is done automatically, so you should have nothing to care about this.
Void screen.startDrawing2D()
(nds, unused)
Start a new drawing and configure 2D. You should have nothing to care about this.
Void screen.endDrawing()
(nds, unused)
End drawing. You will never need to use it (use render()
to command screens actualisation).
Void screen.waitForVBL()
(nds, unused)
Wait for the VBlank period to reach 60FPS. You will never need to use it (using render()
will synchronise the frames).
Color Color.new(r, g, b)
(nds)
Create a new color.
r
(Number): red mask (from 0 to 31)g
(Number): green mask (from 0 to 31)b
(Number): blue mask (from 0 to 31)Color Color.new256(r, g, b)
(nds)
Create a new color from 8bit values.
r
(Number): red mask (from 0 to 255)g
(Number): green mask (from 0 to 255)b
(Number): blue mask (from 0 to 255)Void Controls.read()
(nds)
Read the controls and update all control structures.
Void Controls.setStylusDblcFreq(dblcFreq)
(nds)
Set the maximum delay between two Stylus clicks to make it a double click.
dblcFreq
(Number): maximum delay (from 0 to 30, 30 being half a second and the default value)These are numbers or booleans. Everything here is defined in the nds.
Stylus.X
: x-coordinate of the stylusStylus.Y
: y-coordinate of the stylusStylus.held
: is the stylus held on the screenStylus.released
: is the stylus releasedStylus.doubleClick
: true if stylus do a double clickStylus.deltaX
: delta x of the stylus movementStylus.deltaY
: delta y of the stylus movementStylus.newPress
: true if stylus do a new pressThese are booleans. Everything here is defined in the nds.
[KEY]
can take one of the following values:
A
B
X
Y
L
R
Start
Select
Up
Down
Left
Right
Lid
And then the state of a key can be checked using these subtables:
Keys.held.[KEY]
: is the key held?Keys.released.[KEY]
: is the key released?Keys.newPress.[KEY]
: true if the key does a new pressImage Image.load(path, destination)
(nds)
Create a new image in memory from an image file (PNG, JPG or GIF).
path
(String): path of the image to loaddestination
(Number): destination of the image in memory (can be RAM of VRAM)Void Image.destroy(image)
(nds)
Destroy the image.
image
(Image): image to destroyNumber Image.width(image)
(nds)
Get the width of the image.
image
(Image): image to useNumber Image.height(image)
(nds)
Get the height of the image.
image
(Image): image to useVoid Image.scale(image, width, height)
(nds)
Scale the image.
image
(Image): image to scalewidth
(Number): new width of the imageheight
(Number): new height of the imageVoid Image.rotate(image, angle [, centerx, centery])
(nds)
Rotate the image around rotation center.
image
(Image): image to rotateangle
(Number): angle of roattion (between 0 and 511)centerx
(Number): x-coordinate of the new rotation centercentery
(Number): y-coordinate of the new rotation centerVoid Image.rotateDegree(image, angle [, centerx, centery])
(nds)
Rotate the image around rotation center, the angle is given in degree.
image
(Image): image to rotateangle
(Number): angle of rotation in degree (between 0 and 360)centerx
(Number): x-coordinate of the new rotation centercentery
(Number): y-coordinate of the new rotation centerVoid Image.mirrorH(image, activate)
(nds)
Mirror the image horizontally.
image
(Image): image to mirroractivate
(Boolean): true to activate the mirroring, false to cancel the transformationVoid Image.mirrorV(image, activate)
(nds)
Mirror the image vertically.
image
(Image): image to mirroractivate
(Boolean): true to activate the mirroring, false to cancel the transformationVoid Image.setTint(image, color)
(nds)
Set the tint of the image.
image
(Image): image to tintcolor
(Color): color of the imageThe unit is the millisecond. The return value is a decimal number, not an integer, but no lower precision than 1ms can be guaranteed.
Timer Timer.new([time])
(libs)
Create a new timer, with the specified time
if given.
time
(Number): initial time of the Timer, in millisecond.Number timer:getTime()
(libs)
Return the time of the timer.
Void timer:start()
(libs)
Start a timer.
Void timer:stop()
(libs)
Stop a timer.
Void timer:reset([time])
(libs)
Reset a timer, to 0 or to time
if given.
time
(Number): initial time of the Timer, in millisecond.Sprite Sprite.new(graph, frameWidth, frameHeight, dest)
(libs)
Create a sprite from an image file or an Image resource.
graph
(String or Image): path of the file which contains the sprite; or already loaded Image resourceframeWidth
(Number): width of the framesframeHeight
(Number): height of the framesdest
(Number): destination (RAM or VRAM)Void sprite:destroy()
(libs)
Destroy the Sprite.
Void sprite:drawFrame(screen, x, y, nbFrame)
(libs)
Draw a frame of the sprite.
screen
(Constant / Number): screen (SCREEN_UP or SCREEN_DOWN)x
(Number): X-coordinate where to draw the framey
(Number): Y-coordinate where to draw the framenbFrame
(Number): number of the frame to drawVoid sprite:addAnimation(tabAnim, delay)
(libs)
Create an animation.
tabAnim
(Table): the table of the animation framesdelay
(Number): delay between each frameVoid sprite:playAnimation(screen, x, y, nbAnim)
(libs)
Play an animation on the screen.
screen
(Constant / Number): screen (SCREEN_UP or SCREEN_DOWN)x
(Number): X-coordinate where to draw the framey
(Number): Y-coordinate where to draw the framenbAnim
(Number): number of the animation to playVoid sprite:resetAnimation(nbAnim)
(libs)
Reset an animation.
nbAnim
(Number): number of the animationVoid sprite:startAnimation(nbAnim)
(libs)
Start an animation.
nbAnim
(Number): number of the animationVoid sprite:stopAnimation(nbAnim)
(libs)
Stop an animation.
nbAnim
(Number): number of the animationBoolean sprite:isAnimationAtEnd(nbAnim)
(libs)
Return true if the animation has drawn the last frame.
nbAnim
(Number): number of the animationNumber sprite:getWidth()
(libs)
Return the width of the frames as given to Sprite.new()
.
Number sprite:getHeight()
(libs)
Return the height of the frames as given to Sprite.new()
.
Table SpriteAnimation.new(tabAnim, delay)
(libs, unused)
Create a new sprite animation. You don't have to use it, use sprite:addAnimation()
instead.
tabAnim
(Table): table containing the animation framesdelay
(Number): delay between each frameVoid Debug.ON()
(libs)
Activate the debug mode.
Void Debug.OFF()
(libs)
Deactivate the debug mode.
Void Debug.print(text)
(libs)
Print a debug line.
text
(String): text to printVoid Debug.clear()
(libs)
Clear the debug console.
Void Debug.setColor(color)
(libs)
Set the debug text color.
color
(Color): color of the textString System.currentDirectory()
(nds)
Get the current working directory.
Void System.changeDirectory(path)
(nds)
Change the current working directory.
path
(String): path of the directoryVoid System.remove(name)
(nds)
Remove a file or an empty folder.
name
(String): name of the file or directory to removeVoid System.rename(oldName, newName)
(nds)
Rename file or an empty folder.
oldName
(String): name of the file or directory to renamenewName
(String): new name of the file or directoryVoid System.makeDirectory(name)
(nds)
Create a new directory.
name
(String): path and name of the directoryTable System.listDirectory(path)
(nds)
List all files and folders of a directory.
path
(String): path of the directory to listNOTE: See examples for more details.
Number System.CurrentVramUsed()
(nds)
Give the current amount of used VRAM (seems to return some weird number).
Number System.CurrentVramFree()
(nds)
Give the current amount of free VRAM.
Number System.CurrentPalUsed()
(nds)
Give the current amount of used palette memory (seems to return some weird number).
Number System.CurrentPalFree()
(nds)
Give the current amount of free palette memory.
Void System.setLedBlinkMode(mode)
(nds)
Set the blink mode for the LED.
mode
(Number): the blink mode; choose between LED_ON, LED_BLINK and LED_SLEEPVoid System.shutDown()
(nds)
Shutdown the console.
Void System.sleep()
(nds)
Put the system in sleep state.
Font Font.load(path)
(nds)
Create a new font from a font file (oslib and µLibrary format).
path
(String): path of the file to loadVoid Font.destroy(font)
(nds)
Destroy the font.
font
(Font): font to destroyNumber Font.getCharHeight(font)
(nds)
Get the height of the characters of a font.
font
(Font): font to useNumber getStringWidth(font, text)
(nds)
Get the width of a text with a specific font.
font
(Font): font to usetext
(String): textMap Map.new(image, mapfile, width, height, tileWidth, tileHeight)
(nds)
Create a new map by giving a map file.
image
(Image): image which contains tilesmapfile
(String): path to the map file (.map
)width
(Number): width of the map in tilesheight
(Number): height of the map in tilestileWidth
(Number): width of the tiles in pixelstileHeight
(Number): height of the tiles in pixelsVoid Map.destroy(map)
(nds)
Destroy a map.
map
(Map): map to destroyVoid Map.draw(screen, map, x, y, width, height)
(nds)
Draw a map.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)map
(Map): map to destroyx
(Number): x-coordinate where to draw the mapy
(Number): y-coordinate where to draw the mapwidth
(Number): x number of tiles to drawheight
(Number): y number of tiles to drawVoid Map.scroll(map, x, y)
(nds)
Scroll a map.
map
(Map): map to scrollx
(Number): x number of tiles to scrolly
(Number): y number of tiles to scrollVoid Map.space(map, x, y)
(nds)
Set the space between each tiles of a map.
map
(Map): map to modifyx
(Number): x space between tilesy
(Number): y space between tilesVoid Map.setTile(map, x, y, tile)
(nds)
Change a tile value.
map
(Map): map to modifyx
(Number): x-coordinate of the tile to change in the map tabley
(Number): y-coordinate of the tile to change in the map tabletile
(Number): new tile valueNumber Map.getTile(map, x, y)
(nds)
Get a tile value.
map
(Map): map to readx
(Number): x-coordinate of the tile to gety
(Number): y-coordinate of the tile to getScrollMap ScrollMap.new(image, mapfile, width, height, tileWidth, tileHeight)
(nds)
Create a new ScrollMap by giving a map file.
image
(Image): image which contains tilesmapfile
(String): path to the map file (.map)width
(Number): width of the map in tilesheight
(Number): height of the map in tilestileWidth
(Number): width of the tiles in pixelstileHeight
(Number): height of the tiles in pixelsVoid ScrollMap.destroy(scrollmap)
(nds)
Destroy a ScrollMap.
scrollmap
(ScrollMap): ScrollMap to destroyVoid ScrollMap.draw(screen, scrollmap)
(nds)
Draw a ScrollMap.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)scrollmap
(ScrollMap): ScrollMap to drawVoid ScrollMap.scroll(scrollmap, x, y)
(nds)
Scroll a ScrollMap.
scrollmap
(ScrollMap): ScrollMap to scrollx
(Number): x-coordinate of the upper-left corner of the map (can be a negative value)y
(Number): y-coordinate of the upper-left corner of the map (can be a negative value)Void ScrollMap.setTile(scrollmap, x, y, tile)
(nds)
Change a tile value.
scrollmap
(ScrollMap): ScrollMap to modifyx
(Number): x-coordinate of the tile to change in the scrollmap tabley
(Number): y-coordinate of the tile to change in the scrollmap tabletile
(Number): new tile valueNumber ScrollMap.getTile(scrollmap, x, y)
(nds)
Get a tile value.
scrollmap
(ScrollMap): ScrollMap to readx
(Number): x-coordinate of the tile to gety
(Number): y-coordinate of the tile to getCanvas Canvas.new()
(nds)
Create a new canvas.
Void Canvas.destroy(canvas)
(nds)
Destroy a canvas.
canvas
(Canvas): canvas to destroyCanvasObject Canvas.newLine(x1, y1, x2, y2, color)
(nds)
Create a new line.
x1
, y1
, x2
, y2
(Number): coordinates of the linecolor
(Color): color of the lineCanvasObject Canvas.newPoint(x1, y1, color)
(nds)
Create a new point.
x1
, y1
(Number): coordinates of the pointcolor
(Color): color of the pointCanvasObject Canvas.newRect(x1, y1, x2, y2, color)
(nds)
Create a new rectangle.
x1
, y1
, x2
, y2
(Number): coordinates of the rectanglecolor
(Color): color of the rectangleCanvasObject Canvas.newFillRect(x1, y1, x2, y2, color)
(nds)
Create a new fill rectangle.
x1
, y1
, x2
, y2
(Number): coordinates of the rectanglecolor
(Color): color of the rectangleCanvasObject Canvas.newGradientRect(x1, y1, x2, y2, color1, color2, color3, color4)
(nds)
Create a new gradient rectangle.
x1
, y1
, x2
, y2
(Number): coordinates of the rectanglecolor1
, color2
, color3
, color4
(Color): colors of the fill rectangleCanvasObject Canvas.newText(x1, y1, text [, color])
(nds)
Create a new text.
x1
, y1
(Number): coordinates of the texttext
(String): textcolor
(Color): color of the textCanvasObject Canvas.newTextFont(x1, y1, text, color, font)
(nds)
Create a new text with a special font.
x1
, y1
(Number): coordinates of the texttext
(String): textcolor
(Color): color of the textfont
(Font): special font of the textCanvasObject Canvas.newTextBox(x1, y1, x2, y2, text [, color])
(nds)
Create a new textbox.
x1
, y1
, x2
, y2
(Number): coordinates of the textboxtext
(String): textcolor
(Color): color of the textboxCanvasObject Canvas.newImage(x1, y1, image [, x2, y2] [, x3, y3])
(nds)
Create a new image.
x1
, y1
(Number): coordinates of the imagex2
, y2
(Number): coordinates in the source image to drawx3
, y3
(Number): width and height of the rectangle to drawVoid Canvas.add(canvas, object)
(nds)
Add a CanvasObject in a canvas.
canvas
(Canvas): canvas to drawobject
(CanvasObject): object to addVoid Canvas.draw(screen, canvas, x, y)
(nds)
Draw a canvas to the screen.
screen
(Constant / Number): screen where to draw (SCREEN_UP or SCREEN_DOWN)canvas
(Canvas): canvas to drawx
(Number): x-coordinate where to drawy
(Number): y-coordinate where to drawVoid Canvas.setAttr(object, attrName, attrValue)
(nds)
Set an attribute value.
object
(CanvasObject): object to modifyattName
(Constant / Number): attribute to modify; must be ATTR_XXX
. See Variables for more detailsattrValue
(?): new value for the attribute; must be the good type? Canvas.getAttr(object, attrName)
(nds)
Get an attribute value. Return type depends of the attribute (number, font or image).
object
(CanvasObject): object to useattName
(Constant / Number): attribute to get value. Must be ATTR_XXX
. See Variables for more detailsVoid Canvas.setObjOnTop(canvas, object)
(nds)
Make a CanvasObject on the first plan of a Canvas.
canvas
(Canvas): Canvas in which we work.object
(CanvasObject): Object that we want to set on Top.Void Canvas.removeObj(canvas, object)
(nds)
Delete an CanvasObject in a Canvas.
canvas
(Canvas): Canvas in which we want to delete an Object.object
(CanvasObject): Object that we want to delete.Boolean Rumble.isInserted()
(nds)
Check if a rumble pack is inserted.
Void Rumble.set(status)
(nds)
Set the rumble status.
status
(Boolean): status of the rumble (true: ON, false: OFF)Boolean Motion.init
(nds)
Init the motion system if a motion device is detected. Return true if a motion device is detected.
Void Motion.calibrate
(nds)
Calibrate the motion system.
Number Motion.readX
(nds)
Read the X tilt of the motion.
Number Motion.readY
(nds)
Read the Y tilt of the motion.
Number Motion.readZ
(nds)
Read the Z tilt of the motion.
Number Motion.accelerationX
(nds)
Read the X acceleration of the motion.
Number Motion.accelerationY
(nds)
Read the Y acceleration of the motion.
Number Motion.accelerationZ
(nds)
Read the Z acceleration of the motion.
Number Motion.readGyro
(nds)
Read the gyro value of the motion.
Number Motion.rotation
(nds)
Read the rotation value of the motion.
Void Wifi.connectWFC()
(nds)
Connect the DS to the Wifi connection. Use the firmware configuration. So, you need to configure your connection with an official DS game.
Void Wifi.initDefault()
(nds)
Init the DS Wifi system. Must be done before all Wifi functions except Wifi.connectWFC(). Don't use with Wifi.connectWFC().
Void Wifi.autoConnectWFC()
(nds)
Same as Wifi.connectWFC() but used after Wifi.initDefault().
String Wifi.status()
(nds)
Get the Wifi association status.
Void Wifi.scanAP()
(nds)
Set the DS in scan mode for AP detection (Access Points such as Livebox, Freebox, Neufbox...). When starting, the DS searches all the time but doesn't warn for a found connection.
Number Wifi.getNumAP()
(nds)
Return the number of AP found after a Wifi.scanAP(). The search may be long.
Tableau Wifi.newAP()
(nds)
Return an empty table with AP data. There are:
ssid
(String): name of the network's APbssid
(String):macaddr
(String): MAC address of the APchannel
(Number): network channel numberrssi
(Number): signal strengthmaxrate
(Number): communication speed (1M or 2M)protection
(String): Wifi protection (NONE, WEP, WPA)adhoc
(Boolean): is the connection adhoc (true) or not (false)active
(Boolean): is the connection active (true) or not (false)Tableau Wifi.getAP(numap)
(nds)
Return data about the AP with the number numap
found by Wifi.scanAP()
.
numap
(Number): number of the AP.Number Wifi.connectAP(numap, numkey, key)
(nds)
Make a association request to the AP of index numap
with the key number numkey
and the WEP key key
.
If you intend to associate with an unprotected AP set numkey
to 1 and key
to an empty String ("").
numkey
must be between 1 and 4, but the first key is more often used.
Return -1 if the association is refused.
numap
(Number): AP numbernumkey
(Number): key numberkey
(String): WEP key.Void Wifi.disconnect()
(nds)
Disconnect the DS from the Wifi connection.
Void Wifi.stop()
(nds)
Disengage the Wifi.
String Wifi.getLocalConf(choice)
(nds)
Return data of the DS connection.
choice
(Number): Void Wifi.resetIP()
(nds)
Reset the IP, GateWay, SubnetMask and DNS data.
If called before association, the DS queries the DHCP server.
Void Wifi.setLocalIp(ip, gateway[, subnetmask[, dns1[, dns2]]])
(nds)
Set the IP, gateWay, subnetMask and DNS. The strings must be formated like "N1.N2.N3.N4" where N is a number between 0 to 255.
ip
(String): IP address.gateway
(String): gateway address.subnetmask
(String): subnet mask.dns1
(String): first DNS.dns2
(String): second DNS.Socket Wifi.createTCPSocket()
(nds)
Create a new TCP socket.
Socket Wifi.createUDPSocket()
(nds)
Create an new UDP socket.
Number socket:checkData()
(nds)
Check if there are data in the socket's Wifi buffer and return the number of characters to be read (TCP or UDP).
Void socket:closeSocket()
(nds)
Close a socket (TCP or UDP).
Void udpSocket:sendTo(buffer, host, port)
(nds)
Send data to the given peer.
buffer
(String): data to be senthost
(String): URl of the peerport
(Number): port numberString, String, Number udpSocket:receiveFrom(length)
(nds)
Receive data from any server, and also give the host's IP address and port.
length
(Number): size of the data to receiveVoid udpSocket:setPeerName(host, port)
(nds)
Set the default peer for this UDP socket.
host
(String): URl of the peerport
(Number): port numberVoid udpSocket:send(buffer)
(nds)
Send data to the socket's default peer (raise an error if none has been set).
buffer
(String): data to be sentString udpSocket:receive(length)
(nds)
Receive data from the socket's default peer (raise an error if none has been set).
length
(Number): size of the data to be receivedVoid tcpSocket:connect(host, port)
(nds)
Connect the socket to a peer.
host
(String): URl of the peerport
(Number): port numberVoid tcpSocket:send(buffer)
(nds)
Send data to the socket's peer.
buffer
(String): data to be sentString tcpSocket:receive(length)
(nds)
Receive data from the socket's peer.
length
(Number): size of the data to be receivedBoolean Nifi.init(channel)
(nds)
Init the Wifi in Nifi mode on a channel and return true if success, false otherwise.
channel
(Number): the wifi channel where to discuss (must be between 1 and 13). Void Nifi.changeChannel(channel)
(nds)
Change the channel where the Nifi discuss.
channel
(Number): The new channel (must be between 1 and 13).Void Nifi.stop()
(nds)
Stop the nifi.
Boolean Nifi.checkMessage()
(nds)
Check if a new message is arrived and return true if there is one and false otherwise.
String Nifi.getTrame()
(nds)
Get the last trame receive by Nifi even if it's not address to the NDS. Its max size is 4096 bytes.
Void Nifi.sendMessage(message)
(nds)
Send a message on the channel.
message
(String): Message to send. The max size of the message is 2048 bytes. String Nifi.readMessage()
(nds)
Read the last message received.
Void Sound.loadBank(filename)
(nds)
Load a soundbank from a file in memory.
filename
(String): path of the file to loadVoid Sound.unloadBank()
(nds)
Unload the sound bank from the memory.
Void Sound.loadMod(id)
(nds)
Load a module in memory.
id
(Number): id of the module to loadVoid Sound.unloadMod(id)
(nds)
Unload a module from the memory.
id
(Number): id of the module to unloadVoid Sound.startMod(id, playmode)
(nds)
Start playing a module already loaded in memory.
id
(Number): id of the module to playplaymode
(Number): playing mode (PLAY_ONCE
or PLAY_LOOP
)Void Sound.pause()
(nds)
Pause all modules.
Void Sound.resume()
(nds)
Resume all modules.
Void Sound.stop()
(nds)
Stop all modules.
Void Sound.setPosition(id, position)
(nds)
Set the cursor position of a module.
id
(Number): id of the moduleBoolean Sound.isActive()
(nds)
Return true if the player is active and false otherwise.
Void Sound.startJingle(id)
(nds)
Start playing a module as a jingle.
id
(Number): id of the module to playVoid Sound.setModVolume(volume)
(nds)
Set the volume of the played module.
volume
(Number): new volume value between 0 and 1024Void Sound.setJingleVolume(volume)
(nds)
Set the volume of the played jingle.
volume
(Number): new volume value between 0 and 1024Void Sound.setModTempo(tempo)
(nds)
Set the tempo of the module player.
tempo
(Number): new tempo value between 512 and 2048Void Sound.setModPitch(pitch)
(nds)
Set the pitch of the module player.
pitch
(Number): new pitch valueVoid Sound.loadSFX(id)
(nds)
Load a SFX in the meory.
id
(Number): id of the SFX to loadVoid Sound.unloadSFX(id)
(nds)
Unload a SFX in the meory.
id
(Number): id of the SFX to unloadHandle Sound.startSFX(id)
(nds)
Start a sound effect already loaded in memory. Return and handle to this SFX.
id
(Number): id of the SFX to startVoid Sound.stopSFX(handle)
(nds)
Stop a played SFX.
handle
(Handle): handle of a SFX, given by the startSFX functionVoid Sound.releaseSFX(handle)
(nds)
Mark an effect as low priority.
handle
(Handle): handle of a SFX, given by the startSFX functionVoid Sound.stopAllSFX()
(nds)
Stop all payed SFX.
Void Sound.setSFXVolume(handle, volume)
(nds)
Set the volume of a playing SFX.
handle
(Handle): handle of a SFX, given by the startSFX functionvolume
(Number): new volume value between 0 and 255 (different from Mods)Void Sound.setSFXPanning(handle, panning)
(nds)
Set the panning of a playing SFX.
handle
(Handle): handle of a SFX, given by the startSFX functionpanning
(Number): new panning value between 0 (left) and 255 (right)Void Sound.setSFXPitch(handle, pitch)
(nds)
Set the pitch of a playing SFX.
handle
(Handle): handle of a SFX, given by the startSFX functionpitch
(Number): new pitch valueVoid Sound.setSFXScalePitch(handle, scale)
(nds)
Set the scaling pitch ratio of a playing SFX.
handle
(Handle): handle of a SFX, given by the startSFX functionscale
(Number): new scale pitch valueTable INI.load(filename [, mode])
(libs)
Load an INI file and create a table with it.
filename
(String): file to loadmode
(Boolean): use the simple mode or notVoid INI.save(filename, tab)
(libs)
Save a table in an INI file.
filename
(String): file to loadtab
(Table): table to saveExample:
An INI file contains:
[infos] name=toto age=25
And then in the Lua script:
tab = INI.load(“myfile.ini”) tab[“infos”][“name”] = “tata” INI.save(“myfile.ini”, tab)
This example changes the line name=toto into name=tata.
These tables can only contain Strings! If you want to store numbers convert them with the tostring()
function.
They are defined in nds.
(Number) dsUser.color
: gives the color theme, between 0 and 15(Number) dsUser.birthDay
: gives the birth day(Number) dsUser.birthMonth
: gives the birth month(String) dsUser.name
: gives the user's name(Number) dsUser.nameLength
: gives the user's name length(String) dsUser.message
: gives the user's personal message(Number) dsUser.messageLength
: gives the user's personal message length(Number) dsUser.alarmHour
: gives the alarm hour setting(Number) dsUser.alarmMinute
: gives the alarm minute setting(Number) dsUser.language
: gives the user's language, between 0 and 5(Boolean) dsUser.GBAScreen
: gives the GBA screen setting (true for the upper screen, and false for the lower screen)(Number) dsUser.defaultBrightness
: gives the default brightness (between 0 and 3 with a NDS Lite)(Boolean) dsUser.getAutoMode
: gives the auto launching mode setting (true if enabled, and false if disabled)They are not really useful since the variables herebefore are based on them.
Number dsUser.getColor()
Give the color theme, between 0 and 15.
Number dsUser.getBirthDay()
Give the birth day.
Number dsUser.getBirthMonth()
Give the birth month.
String dsUser.getName()
Give the user's name.
Number dsUser.getNameLength()
Give the user's name length.
String dsUser.getMessage()
Give the user's personal message.
Number dsUser.getMessageLength()
Give the user's personal message length.
Number dsUser.getAlarmHour()
Give the alarm hour setting.
Number dsUser.getAlarmMinute()
Give the alarm minute setting.
Number dsUser.getLanguage()
Give the user's language, between 0 and 5.
Boolean dsUser.getGBAScreen()
Give the GBA screen setting (true for the upper screen, and false for the lower screen).
Number dsUser.getDefaultBrightness()
Give the default brightness (between 0 and 3 with a NDS Lite).
Boolean dsUser.getAutoMode()
Give the auto launching mode setting (true if enabled, and false if disabled).