The variables or functions that you will find here may be defined in the Lua libraries (
libs tag) or in the C code (
nds tag).
-
MICROLUA_VERSION
MICROLUA_VERSION* (_libs_): version of Micro Lua (String).
* *
(libs): version of Micro Lua (String). -
SCREEN_WIDTH
SCREEN_WIDTH*, *
, SCREEN_HEIGHT
SCREEN_HEIGHT* (_libs_): width and height of the screens.
* *
(libs): width and height of the screens. -
NB_FPS
NB_FPS* (_libs_): number of frame per second automatically updated each second. You can display it with a
(libs): number of frame per second automatically updated each second. You can display it with a screen.print()
screen.print() between
between screen.startDrawing()
screen.startDrawing() and
and screen.stopDrawing()
screen.stopDrawing(). Don’t display it in the debug console.
* *
. Don’t display it in the debug console. -
SCREEN_UP
SCREEN_UP*, *
, SCREEN_DOWN
SCREEN_DOWN* (_libs_): screen number where to draw. See examples for more details.
* *
(libs): screen number where to draw. See examples for more details. -
RAM
RAM* and *
and VRAM
VRAM* (_libs_): destination where to load some object. See examples for more details.
* *
(libs): destination where to load some object. See examples for more details. -
ATTR_X1
ATTR_X1*, *
, ATTR_Y1
ATTR_Y1*, *
, ATTR_X2
ATTR_X2*, *
, ATTR_Y2
ATTR_Y2*, *
, ATTR_X3
ATTR_X3*, *
, ATTR_Y3
ATTR_Y3*, *
, ATTR_COLOR
ATTR_COLOR*, *
, ATTR_COLOR1
ATTR_COLOR1*, *
, ATTR_COLOR2
ATTR_COLOR2*, *
, ATTR_COLOR3
ATTR_COLOR3*, *
, ATTR_COLOR4
ATTR_COLOR4*, *
, ATTR_TEXT
ATTR_TEXT*, *
, ATTR_VISIBLE
ATTR_VISIBLE*, *
, ATTR_FONT
ATTR_FONT*, *
, ATTR_IMAGE
ATTR_IMAGE* (_libs_): attributes used in canvas.
not documented: PLAY_LOOP, PLAY_ONCE, mustCountFPS
== Functions and their table ==
=== Screen ===
*
(libs): attributes used in canvas.
Void render()
Void render()* (_libs_)
Refresh the screen.
*
(
libs)
Refresh the screen.
Void startDrawing()
Void startDrawing()* & *
&
Void stopDrawing()
Void stopDrawing()* (_libs_, _deprecated_)
All your drawing instructions must be between these two functions.
*
(
libs,
deprecated)
All your drawing instructions must be between these two functions.
Void screen.switch()
Void screen.switch()* (_nds_)
Switch the screens.
*
(
nds)
Switch the screens.
Void screen.print(screen, x, y, text [, color])
Void screen.print(screen, x, y, text [, color])* (_nds_)
Print a text on the screen.
* *screen* (Number): screen where to draw (
(
nds)
Print a text on the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x* (Number): x-coordinate where to draw
* *y* (Number): y-coordinate where to draw
* *text* (String): text to print
* *color* (Color): color of the text
*
) - x (Number): x-coordinate where to draw
- y (Number): y-coordinate where to draw
- text (String): text to print
- color (Color): color of the text
Void screen.printFont(screen, x, y, text , color, font)
Void screen.printFont(screen, x, y, text , color, font)* (_nds_)
Print a text on the screen using a special font.
* *screen* (Number): screen where to draw (
(
nds)
Print a text on the screen using a special font.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x* (Number): x-coordinate where to draw
* *y* (Number): y-coordinate where to draw
* *text* (String): text to print
* *color* (Color): color of the text
* *font* (Font) : special font
*
) - x (Number): x-coordinate where to draw
- y (Number): y-coordinate where to draw
- text (String): text to print
- color (Color): color of the text
- font (Font) : special font
Void screen.blit(screen, x, y, image, [, sourcex, sourcey] [, width, height])
Void screen.blit(screen, x, y, image, [, sourcex, sourcey] [, width, height])* (_nds_)
Blit an image on the screen.
* *screen* (Number): screen where to draw (
(
nds)
Blit an image on the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x* (Number): x-coordinate where to draw
* *y* (Number): y-coordinate where to draw
* *image* (Image): image to blit
* *sourcex*, *sourcey* (Number): coordinates in the source image to draw
* *width*, *height* (Number): width and height of the rectangle to draw
*
) - x (Number): x-coordinate where to draw
- y (Number): y-coordinate where to draw
- image (Image): image to blit
- sourcex, sourcey (Number): coordinates in the source image to draw
- width, height (Number): width and height of the rectangle to draw
Void screen.drawLine(screen, x0, y0, x1, y1, color)
Void screen.drawLine(screen, x0, y0, x1, y1, color)* (_nds_)
Draw a line on the screen.
* *screen* (Number): screen where to draw (
(
nds)
Draw a line on the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x0*, *y0*, *x1*, *y1* (Number): coordinates of the line
* *color* (Color): color of the line
*
) - x0, y0, x1, y1 (Number): coordinates of the line
- color (Color): color of the line
Void screen.drawRect(screen, x0, y0, x1, y1, color)
Void screen.drawRect(screen, x0, y0, x1, y1, color)* (_nds_)
Draw a rectangle on the screen.
* *screen* (Number): screen where to draw (
(
nds)
Draw a rectangle on the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x0*, *y0*, *x1*, *y1* (Number): coordinates of the rectangle
* *color* (Color): color of the rectangle
*
) - x0, y0, x1, y1 (Number): coordinates of the rectangle
- color (Color): color of the rectangle
Void screen.drawFillRect(screen, x0, y0, x1, y1, color)
Void screen.drawFillRect(screen, x0, y0, x1, y1, color)* (_nds_)
Draw a fill rectangle on the screen.
* *screen* (Number): screen where to draw (
(
nds)
Draw a fill rectangle on the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x0*, *y0*, *x1*, *y1* (Number): coordinates of the rectangle
* *color* (Color): color of the rectangle
*
) - x0, y0, x1, y1 (Number): coordinates of the rectangle
- color (Color): color of the rectangle
Void screen.drawGradientRect(screen, x0, y0, x1, y1, color1, color2, color3, color4)
Void screen.drawGradientRect(screen, x0, y0, x1, y1, color1, color2, color3, color4)* (_nds_)
Draw a gradient rectangle on the screen.
* *screen* (Number): screen where to draw (
(
nds)
Draw a gradient rectangle on the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x0*, *y0*, *x1*, *y1* (Number): coordinates of the rectangle
* *color1*, *color2*, *color3*, *color4* (Color): colors of the rectangle
*
) - x0, y0, x1, y1 (Number): coordinates of the rectangle
- color1, color2, color3, color4 (Color): colors of the rectangle
Void screen.drawTextBox(screen, x0, y0, x1, y1, text [, color])
Void screen.drawTextBox(screen, x0, y0, x1, y1, text [, color])* (_nds_)
Draw a text box on the screen.
* *screen* (Number): screen where to draw (
(
nds)
Draw a text box on the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x0*, *y0*, *x1*, *y1* (Number): coordinates of the text box
* *text* (String): text to print
* *color* (Color): color of the text box
not documented: screen.init, screen_getMainLcd, screen_startDrawing2D, screen_endDrawing, screen_waitForVBL, screen.setSpaceBetweenScreens
=== Colors ===
*
) - x0, y0, x1, y1 (Number): coordinates of the text box
- text (String): text to print
- color (Color): color of the text box
Color Color.new(r, g, b)
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)
=== Controls ===
*
(
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)
Void Controls.read()
Void Controls.read()* (_libs_)
Read the controls and update all control structures.
==== Stylus ====
These are numbers or booleans. Everything here is defined in the _libs_.
*
(
libs)
Read the controls and update all control structures.
These are numbers or booleans. Everything here is defined in the
libs.
Stylus.X
Stylus.X*: x-coordinate of the stylus
*
: x-coordinate of the stylus
Stylus.Y
Stylus.Y*: y-coordinate of the stylus
*
: y-coordinate of the stylus
Stylus.held
Stylus.held*: is the stylus held on the screen
*
: is the stylus held on the screen
Stylus.released
Stylus.released*: is the stylus released
*
: is the stylus released
Stylus.doubleClick
Stylus.doubleClick:
: true
true* if stylus do a double click
*
if stylus do a double click
Stylus.deltaX
Stylus.deltaX*: delta x of the stylus movement
*
: delta x of the stylus movement
Stylus.deltaY
Stylus.deltaY*: delta y of the stylus movement
*
: delta y of the stylus movement
Stylus.newPress
Stylus.newPress:
: true
true* if stylus do a new press
==== Keys ====
These are booleans. Everything here is defined in the _libs_.
(
if stylus do a new press
These are booleans. Everything here is defined in the
libs.
(
[KEY]
KEY can take the following values :
*
can take the following values :
A
A,
, B
B,
, X
X,
, Y
Y,
, L
L,
, R
R,
, Start
Start,
, Select
Select,
, Up
Up,
, Down
Down,
, Left
Left,
, Right
Right*)
*
)
Keys.held.[KEY]
Keys.held.KEY*: is the key held?
*
: is the key held?
Keys.released.[KEY]
Keys.released.KEY*: is the key released?
*
: is the key released?
Keys.newPress.[KEY]
Keys.newPress.KEY:
: true
true* if the key does a new press
=== Images ===
*
if the key does a new press
Image Image.load(path, destination)
Image 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 load
* *destination* (Number): destination of the image in memory (can be RAM of VRAM)
*
(
nds)
Create a new image in memory from an image file (PNG, JPG or GIF).
- path (String): path of the image to load
- destination (Number): destination of the image in memory (can be RAM of VRAM)
Void Image.destroy(image)
Void Image.destroy(image)* (_nds_)
Destroy the image.
* *image* (Image): image to destroy
To completely destroy an image, do:
{{{
myImage:destroy()
myImage = nil
}}}
*
(
nds)
Destroy the image.
- image (Image): image to destroy
To completely destroy an image, do:
myImage:destroy()
myImage = nil
myImage:destroy()
myImage = nil
}}}
Number Image.width(image)
Number Image.width(image)* (_nds_)
Get the width of the image.
* *image* (Image): image to use
*
(
nds)
Get the width of the image.
- image (Image): image to use
Number Image.height(image)
Number Image.height(image)* (_nds_)
Get the height of the image.
* *image* (Image): image to use
*
(
nds)
Get the height of the image.
- image (Image): image to use
Void Image.scale(image, width, height)
Void Image.scale(image, width, height)* (_nds_)
Scale the image.
* *image* (Image): image to scale
* *width* (Number): new width of the image
* *height* (Number): new height of the image
*
(
nds)
Scale the image.
- image (Image): image to scale
- width (Number): new width of the image
- height (Number): new height of the image
Void Image.rotate(image, angle [, centerx, centery])
Void Image.rotate(image, angle [, centerx, centery])* (_nds_)
Rotate the image around rotation center.
* *image* (Image): image to rotate
* *angle* (Number): angle of roattion (between 0 and 511)
* *centerx* (Number): x-coordinate of the new rotation center
* *centery* (Number): y-coordinate of the new rotation center
*
(
nds)
Rotate the image around rotation center.
- image (Image): image to rotate
- angle (Number): angle of roattion (between 0 and 511)
- centerx (Number): x-coordinate of the new rotation center
- centery (Number): y-coordinate of the new rotation center
Void Image.rotateDegree(image, angle [, centerx, centery])
Void Image.rotateDegree(image, angle [, centerx, centery])* (_nds_)
Rotate the image around rotation center, the angle is given in degree.
* *image* (Image): image to rotate
* *angle* (Number): angle of rotation in degree (between 0 and 360)
* *centerx* (Number): x-coordinate of the new rotation center
* *centery* (Number): y-coordinate of the new rotation center
*
(
nds)
Rotate the image around rotation center, the angle is given in degree.
- image (Image): image to rotate
- angle (Number): angle of rotation in degree (between 0 and 360)
- centerx (Number): x-coordinate of the new rotation center
- centery (Number): y-coordinate of the new rotation center
Void Image.mirrorH(image)
Void Image.mirrorH(image)* (_nds_)
Mirror the image horizontally.
* *image* (Image): image to mirror
*
(
nds)
Mirror the image horizontally.
- image (Image): image to mirror
Void Image.mirrorV(image)
Void Image.mirrorV(image)* (_nds_)
Mirror the image vertically.
* *image* (Image): image to mirror
*
(
nds)
Mirror the image vertically.
- image (Image): image to mirror
Void Image.setTint(image, color)
Void Image.setTint(image, color)* (_nds_)
Set the tint of the image.
* *image* (Image): image to tint
* *color* (Color): color of the image
=== Timers ===
The unit is the millisecond.
*
(
nds)
Set the tint of the image.
- image (Image): image to tint
- color (Color): color of the image
The unit is the millisecond.
Timer Timer.new()
Timer Timer.new()* (_libs_)
Create a new timer, you can start it.
*
(
libs)
Create a new timer, you can start it.
Number timer:time()
Number timer:time()* (_libs_)
Return the time of the timer.
*
(
libs)
Return the time of the timer.
Void timer:start()
Void timer:start()* (_libs_)
Start a timer.
*
(
libs)
Start a timer.
Void timer:stop()
Void timer:stop()* (_libs_)
Stop a timer.
*
(
libs)
Stop a timer.
Void timer:reset()
Void timer:reset()* (_libs_)
Reset a timer.
=== Sprites ===
*
(
libs)
Reset a timer.
Sprite Sprite.new(path, frameWidth, frameHeight, dest)
Sprite Sprite.new(path, frameWidth, frameHeight, dest)* (_libs_)
Create a sprite from an image file.
* *path* (String): path of the file which contains the sprite
* *frameWidth* (Number): width of the frames
* *frameHeight* (Number): height of the frames
* *dest* (Number): destination (RAM or VRAM)
*
(
libs)
Create a sprite from an image file.
- path (String): path of the file which contains the sprite
- frameWidth (Number): width of the frames
- frameHeight (Number): height of the frames
- dest (Number): destination (RAM or VRAM)
Void sprite:drawFrame(screen, x, y, nbFrame)
Void sprite:drawFrame(screen, x, y, nbFrame)* (_libs_)
Draw a frame of the sprite.
* *screen* (Number): screen (
(
libs)
Draw a frame of the sprite.
- screen (Number): screen (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x* (Number): X-coordinate where to draw the frame
* *y* (Number): Y-coordinate where to draw the frame
* *nbFrame* (Number): number of the frame to draw
*
) - x (Number): X-coordinate where to draw the frame
- y (Number): Y-coordinate where to draw the frame
- nbFrame (Number): number of the frame to draw
Void sprite:addAnimation(tabAnim, delay)
Void sprite:addAnimation(tabAnim, delay)* (_libs_)
Create an animation.
* *tabAnim* (Table): the table of the animation frames
* *delay* (Number): delay between each frame
*
(
libs)
Create an animation.
- tabAnim (Table): the table of the animation frames
- delay (Number): delay between each frame
Void sprite:playAnimation(screen, x, y, nbAnim)
Void sprite:playAnimation(screen, x, y, nbAnim)* (_libs_)
Play an animation on the screen.
* *screen* (Number): screen (
(
libs)
Play an animation on the screen.
- screen (Number): screen (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *x* (Number): X-coordinate where to draw the frame
* *y* (Number): Y-coordinate where to draw the frame
* *nbAnim* (Number): number of the animation to play
*
) - x (Number): X-coordinate where to draw the frame
- y (Number): Y-coordinate where to draw the frame
- nbAnim (Number): number of the animation to play
Void sprite:resetAnimation(nbAnim)
Void sprite:resetAnimation(nbAnim)* (_libs_)
Reset an animation.
* *nbAnim* (Number): number of the animation
*
(
libs)
Reset an animation.
- nbAnim (Number): number of the animation
Void sprite:startAnimation(nbAnim)
Void sprite:startAnimation(nbAnim)* (_libs_)
Start an animation.
* *nbAnim* (Number): number of the animation
*
(
libs)
Start an animation.
- nbAnim (Number): number of the animation
Void sprite:stopAnimation(nbAnim)
Void sprite:stopAnimation(nbAnim)* (_libs_)
Stop an animation.
* *nbAnim* (Number): number of the animation
*
(
libs)
Stop an animation.
- nbAnim (Number): number of the animation
Boolean sprite:isAnimationAtEnd(nbAnim)
Boolean sprite:isAnimationAtEnd(nbAnim)* (_libs_)
Return
(
libs)
Return
true
true
if the animation has drawn the last frame.
* *nbAnim* (Number): number of the animation
not documented: SpriteAnimation
=== Debug ===
*
if the animation has drawn the last frame.
- nbAnim (Number): number of the animation
Void Debug.ON()
Void Debug.ON()* (_libs_)
Activate the debug mode.
*
(
libs)
Activate the debug mode.
Void Debug.OFF()
Void Debug.OFF()* (_libs_)
Desactivate the debug mode.
*
(
libs)
Desactivate the debug mode.
Void Debug.print(text)
Void Debug.print(text)* (_libs_)
Print a debug line.
* *text* (String): text to print
*
(
libs)
Print a debug line.
- text (String): text to print
Void Debug.clear()
Void Debug.clear()* (_libs_)
Clear the debug console.
*
(
libs)
Clear the debug console.
Void Debug.setColor(color)
Void Debug.setColor(color)* (_libs_)
Set the debug text color.
* *color* (Color): color of the text
not documented: isDebugOn, debugText, debugColor
=== System ===
*
(
libs)
Set the debug text color.
- color (Color): color of the text
String System.currentDirectory()
String System.currentDirectory()* (_libs_)
Get the current working directory.
*
(
libs)
Get the current working directory.
Void System.changeDirectory(path)
Void System.changeDirectory(path)* (_libs_)
Change the current working directory.
* *path* (String): path of the directory
*
(
libs)
Change the current working directory.
- path (String): path of the directory
Void System.remove(name)
Void System.remove(name)* (_libs_)
Remove a file or an empty folder.
* *name* (String): name of the file or directory to remove
*
(
libs)
Remove a file or an empty folder.
- name (String): name of the file or directory to remove
Void System.rename(oldName, newName)
Void System.rename(oldName, newName)* (_libs_)
Rename file or an empty folder.
* *oldName* (String): name of the file or directory to rename
* *newName* (String): new name of the file or directory
*
(
libs)
Rename file or an empty folder.
- oldName (String): name of the file or directory to rename
- newName (String): new name of the file or directory
Void System.makeDirectory(name)
Void System.makeDirectory(name)* (_libs_)
Create a new directory.
* *name* (String): path and name of the directory
*
(
libs)
Create a new directory.
- name (String): path and name of the directory
Table System.listDirectory(path)
Table System.listDirectory(path)* (_libs_)
List all files and folders of a directory.
* *path* (String): path of the directory to list
* *NOTE*: See examples for more details.
=== Fonts ===
*
(
libs)
List all files and folders of a directory.
- path (String): path of the directory to list
- NOTE: See examples for more details.
Font Font.load(path)
Font Font.load(path)* (_nds_)
Create a new font from a font file (oslib and µLibrary format).
* *Path* (String): path of the file to load
*
(
nds)
Create a new font from a font file (oslib and µLibrary format).
- Path (String): path of the file to load
Void Font.destroy(font)
Void Font.destroy(font)* (_nds_)
Destroy the font.
* *font* (Font): font to destroy
To completely destroy a font, do:
{{{
Font.destroy(font)
font = nil
}}}
*
(
nds)
Destroy the font.
- font (Font): font to destroy
To completely destroy a font, do:
Font.destroy(font)
font = nil
Font.destroy(font)
font = nil
}}}
Void Font.print(screen, font, x, y, text [, color])
Void Font.print(screen, font, x, y, text [, color])* (_nds_, _deprecated_)
Please use
(
nds,
deprecated)
Please use
screen.printFont
screen.printFont
which really handles the color.
Print a text with a special font.
* *screen* (Number): screen where to draw (
which really handles the color.
Print a text with a special font.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *font* (Font): font to use
* *x* (Number): x-coordinate where to draw
* *y* (Number): y-coordinate where to draw
* *text* (String): text to print
* *color* (Color): color of the text
*
) - font (Font): font to use
- x (Number): x-coordinate where to draw
- y (Number): y-coordinate where to draw
- text (String): text to print
- color (Color): color of the text
Number Font.getCharHeight(font)
Number Font.getCharHeight(font)* (_nds_)
Get the height of the characters of a font.
* *font* (Font): font to use
*
(
nds)
Get the height of the characters of a font.
Number getStringWidth(font, text)
Number getStringWidth(font, text)* (_nds_)
Get the width of a text with a specific font.
* *font* (Font): font to use
* *text* (String): text
not documented: destroy
=== Maps ===
*
(
nds)
Get the width of a text with a specific font.
- font (Font): font to use
- text (String): text
Map Map.new(image, mapfile, width, height, tileWidth, tileHeight)
Map Map.new(image, mapfile, width, height, tileWidth, tileHeight)* (_nds_)
Create a new map by giving a map file.
* *image* (Image): image which contains tiles
* *mapfile* (String): path to the map file (
(
nds)
Create a new map by giving a map file.
- image (Image): image which contains tiles
- mapfile (String): path to the map file (
.map
.map)
* *width* (Number): width of the map in tiles
* *height* (Number): height of the map in tiles
* *tileWidth* (Number): width of the tiles in pixels
* *tileHeight* (Number): height of the tiles in pixels
*
) - width (Number): width of the map in tiles
- height (Number): height of the map in tiles
- tileWidth (Number): width of the tiles in pixels
- tileHeight (Number): height of the tiles in pixels
Void Map.destroy(map)
Void Map.destroy(map)* (_nds_)
Destroy a map.
* *map* (Map): map to destroy
*
(
nds)
Destroy a map.
- map (Map): map to destroy
Void Map.draw(screen, map, x, y, width, height)
Void Map.draw(screen, map, x, y, width, height)* (_nds_)
Draw a map.
* *screen* (Number): screen where to draw (
(
nds)
Draw a map.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *map* (Map): map to destroy
* *x* (Number): x-coordinate where to draw the map
* *y* (Number): y-coordinate where to draw the map
* *width* (Number): x number of tiles to draw
* *height* (Number): y number of tiles to draw
*
) - map (Map): map to destroy
- x (Number): x-coordinate where to draw the map
- y (Number): y-coordinate where to draw the map
- width (Number): x number of tiles to draw
- height (Number): y number of tiles to draw
Void Map.scroll(map, x, y)
Void Map.scroll(map, x, y)* (_nds_)
Scroll a map.
* *map* (Map): map to scroll
* *x* (Number): x number of tiles to scroll
* *y* (Number): y number of tiles to scroll
*
(
nds)
Scroll a map.
- map (Map): map to scroll
- x (Number): x number of tiles to scroll
- y (Number): y number of tiles to scroll
Void Map.space(map, x, y)
Void Map.space(map, x, y)* (_nds_)
Set the space between each tiles of a map.
* *map* (Map): map to modify
* *x* (Number): x space between tiles
* *y* (Number): y space between tiles
*
(
nds)
Set the space between each tiles of a map.
- map (Map): map to modify
- x (Number): x space between tiles
- y (Number): y space between tiles
Void Map.setTile(map, x, y, tile)
Void Map.setTile(map, x, y, tile)* (_nds_)
Change a tile value.
* *map* (Map): map to modify
* *x* (Number): x-coordinate of the tile to change in the map table
* *y* (Number): y-coordinate of the tile to change in the map table
* *tile* (Number): new tile value
*
(
nds)
Change a tile value.
- map (Map): map to modify
- x (Number): x-coordinate of the tile to change in the map table
- y (Number): y-coordinate of the tile to change in the map table
- tile (Number): new tile value
Number Map.getTile(map, x, y)
Number Map.getTile(map, x, y)* (_nds_)
Get a tile value.
* *map* (Map): map to read
* *x* (Number): x-coordinate of the tile to get
* *y* (Number): y-coordinate of the tile to get
=== Scroll Maps ===
*
(
nds)
Get a tile value.
- map (Map): map to read
- x (Number): x-coordinate of the tile to get
- y (Number): y-coordinate of the tile to get
ScrollMap ScrollMap.new(image, mapfile, width, height, tileWidth, tileHeight)
ScrollMap ScrollMap.new(image, mapfile, width, height, tileWidth, tileHeight)* (_nds_)
* *image* (Image): image which contains tiles
* *mapfile* (String): path to the map file (.map)
* *width* (Number): width of the map in tiles
* *height* (Number): height of the map in tiles
* *tileWidth* (Number): width of the tiles in pixels
* *tileHeight* (Number): height of the tiles in pixels
*
(
nds)
- image (Image): image which contains tiles
- mapfile (String): path to the map file (.map)
- width (Number): width of the map in tiles
- height (Number): height of the map in tiles
- tileWidth (Number): width of the tiles in pixels
- tileHeight (Number): height of the tiles in pixels
Void ScrollMap.destroy(scrollmap)
Void ScrollMap.destroy(scrollmap)* (_nds_)
Destroy a ScrollMap.
* *scrollmap* (ScrollMap): ScrollMap to destroy
*
(
nds)
Destroy a
ScrollMap.
Void ScrollMap.draw(screen, scrollmap)
Void ScrollMap.draw(screen, scrollmap)* (_nds_)
Draw a ScrollMap.
* *scrollmap* (ScrollMap): ScrollMap to draw
*
(
nds)
Draw a
ScrollMap.
Void ScrollMap.scroll(scrollmap, x, y)
Void ScrollMap.scroll(scrollmap, x, y)* (_nds_)
Scroll a ScrollMap.
* *scrollmap* (ScrollMap): ScrollMap to scroll
* *x* (Number): x scrolling in pixel
* *y* (Number): y scrolling in pixel
*
(
nds)
Scroll a
ScrollMap.
- scrollmap (ScrollMap): ScrollMap to scroll
- x (Number): x scrolling in pixel
- y (Number): y scrolling in pixel
Void ScrollMap.setTile(scrollmap, x, y, tile)
Void ScrollMap.setTile(scrollmap, x, y, tile)* (_nds_)
Change a tile value.
* *scrollmap* (ScrollMap): ScrollMap to modify
* *x* (Number): x-coordinate of the tile to change in the scrollmap table
* *y* (Number): y-coordinate of the tile to change in the scrollmap table
* *tile* (Number): new tile value
*
(
nds)
Change a tile value.
- scrollmap (ScrollMap): ScrollMap to modify
- x (Number): x-coordinate of the tile to change in the scrollmap table
- y (Number): y-coordinate of the tile to change in the scrollmap table
- tile (Number): new tile value
Number ScrollMap.getTile(scrollmap, x, y)
Number ScrollMap.getTile(scrollmap, x, y)* (_nds_)
Get a tile value.
* *scrollmap* (ScrollMap): ScrollMap to read
* *x* (Number): x-coordinate of the tile to get
* *y* (Number): y-coordinate of the tile to get
=== Canvas ===
*
(
nds)
Get a tile value.
- scrollmap (ScrollMap): ScrollMap to read
- x (Number): x-coordinate of the tile to get
- y (Number): y-coordinate of the tile to get
Canvas Canvas.new()
Canvas Canvas.new()* (_nds_)
Create a new canvas.
*
(
nds)
Create a new canvas.
Void Canvas.destroy(canvas)
Void Canvas.destroy(canvas)* (_nds_)
Destroy a canvas. Must be followed by
(
nds)
Destroy a canvas. Must be followed by
canvas = nil
canvas = nil
.
* *Canvas* (Canvas): canvas to destroy
*
.
- Canvas (Canvas): canvas to destroy
CanvasObject Canvas.newLine(x1, y1, x2, y2, color)
CanvasObject Canvas.newLine(x1, y1, x2, y2, color)* (_nds_)
Create a new line.
* *x1*, *y1*, *x2*, *y2* (Number): coordinates of the line
* *color* (Color): color of the line
*
(
nds)
Create a new line.
- x1, y1, x2, y2 (Number): coordinates of the line
- color (Color): color of the line
CanvasObject Canvas.newPoint(x1, y1, color)
CanvasObject Canvas.newPoint(x1, y1, color)* (_nds_)
Create a new point.
* *x1*, *y1* (Number): coordinates of the point
* *color* (Color): color of the point
*
(
nds)
Create a new point.
- x1, y1 (Number): coordinates of the point
- color (Color): color of the point
CanvasObject Canvas.newRect(x1, y1, x2, y2, color)
CanvasObject Canvas.newRect(x1, y1, x2, y2, color)* (_nds_)
Create a new rectangle.
* *x1*, *y1*, *x2*, *y2* (Number): coordinates of the rectangle
* *color* (Color): color of the rectangle
*
(
nds)
Create a new rectangle.
- x1, y1, x2, y2 (Number): coordinates of the rectangle
- color (Color): color of the rectangle
CanvasObject Canvas.newFillRect(x1, y1, x2, y2, color)
CanvasObject Canvas.newFillRect(x1, y1, x2, y2, color)* (_nds_)
Create a new fill rectangle.
* *x1*, *y1*, *x2*, *y2* (Number): coordinates of the rectangle
* *color* (Color): color of the rectangle
*
(
nds)
Create a new fill rectangle.
- x1, y1, x2, y2 (Number): coordinates of the rectangle
- color (Color): color of the rectangle
CanvasObject Canvas.newGradientRect(x1, y1, x2, y2, color1, color2, color3, color4)
CanvasObject Canvas.newGradientRect(x1, y1, x2, y2, color1, color2, color3, color4)* (_nds_)
Create a new gradient rectangle.
* *x1*, *y1*, *x2*, *y2* (Number): coordinates of the rectangle
* *color1*, *color2*, *color3*, *color4* (Color): colors of the fill rectangle
*
(
nds)
Create a new gradient rectangle.
- x1, y1, x2, y2 (Number): coordinates of the rectangle
- color1, color2, color3, color4 (Color): colors of the fill rectangle
CanvasObject Canvas.newText(x1, y1, text [, color])
CanvasObject Canvas.newText(x1, y1, text [, color])* (_nds_)
Create a new text.
* *x1*, *y1* (Number): coordinates of the text
* *text* (String): text
* *color* (Color): color of the text
*
(
nds)
Create a new text.
- x1, y1 (Number): coordinates of the text
- text (String): text
- color (Color): color of the text
CanvasObject Canvas.newTextFont(x1, y1, text, color, font)
CanvasObject Canvas.newTextFont(x1, y1, text, color, font)* (_nds_)
Create a new text with a special font.
* *x1*, *y1* (Number): coordinates of the text
* *text* (String): text
* *color* (Color): color of the text
* *font* (Font): special font of the text
*
(
nds)
Create a new text with a special font.
- x1, y1 (Number): coordinates of the text
- text (String): text
- color (Color): color of the text
- font (Font): special font of the text
CanvasObject Canvas.newTextBox(x1, y1, x2, y2, text [, color])
CanvasObject Canvas.newTextBox(x1, y1, x2, y2, text [, color])* (_nds_)
Create a new textbox.
* *x1*, *y1*, *x2*, *y2* (Number): coordinates of the textbox
* *text* (String): text
* *color* (Color): color of the textbox
*
(
nds)
Create a new textbox.
- x1, y1, x2, y2 (Number): coordinates of the textbox
- text (String): text
- color (Color): color of the textbox
CanvasObject Canvas.newImage(x1, y1, image [, x2, y2] [, x3, y3])
CanvasObject Canvas.newImage(x1, y1, image [, x2, y2] [, x3, y3])* (_nds_)
Create a new image.
* *x1*, *y1* (Number): coordinates of the image
* *x2*, *y2* (Number): coordinates in the source image to draw
* *x3*, *y3* (Number): width and height of the rectangle to draw
*
(
nds)
Create a new image.
- x1, y1 (Number): coordinates of the image
- x2, y2 (Number): coordinates in the source image to draw
- x3, y3 (Number): width and height of the rectangle to draw
Void Canvas.add(canvas, object)
Void Canvas.add(canvas, object)* (_nds_)
Add a CanvasObject in a canvas.
* *canvas* (Canvas): canvas to draw
* *object* (CanvasObject): object to add
*
(
nds)
Add a CanvasObject in a canvas.
- canvas (Canvas): canvas to draw
- object (CanvasObject): object to add
Void Canvas.draw(screen, canvas, x, y)
Void Canvas.draw(screen, canvas, x, y)* (_nds_)
Draw a canvas to the screen.
* *screen* (Number): screen where to draw (
(
nds)
Draw a canvas to the screen.
- screen (Number): screen where to draw (
SCREEN_UP
SCREEN_UP or
or SCREEN_DOWN
SCREEN_DOWN)
* *canvas* (Canvas): canvas to draw
* *x* (Number): x-coordinate where to draw
* *y* (Number): y-coordinate where to draw
*
) - canvas (Canvas): canvas to draw
- x (Number): x-coordinate where to draw
- y (Number): y-coordinate where to draw
Void Canvas.setAttr(object, attrName, attrValue)
Void Canvas.setAttr(object, attrName, attrValue)* (_nds_)
Set an attribute value.
* *object* (CanvasObject): object to modify
* *attName* (Constant): attribute to modify. Must be ATTR_XXX. See “some useful variables” for more details
* *attrValue* (?): new value for the attribute. Must be the good type
*
(
nds)
Set an attribute value.
- object (CanvasObject): object to modify
- attName (Constant): attribute to modify. Must be ATTR_XXX. See “some useful variables” for more details
- attrValue (?): new value for the attribute. Must be the good type
? Canvas.getAttr(object, attrName)
? Canvas.getAttr(object, attrName)* (_nds_)
Get an attribute value. Return type depends of the attribute (number, font or image).
* *object* (CanvasObject): object to use
* *attName* (Constant): attribute to get value. Must be ATTR_XXX. See “some useful variables” for more details
=== Rumble ===
*
(
nds)
Get an attribute value. Return type depends of the attribute (number, font or image).
- object (CanvasObject): object to use
- attName (Constant): attribute to get value. Must be ATTR_XXX. See “some useful variables” for more details
Boolean Rumble.isInserted()
Boolean Rumble.isInserted()* (_nds_)
Check if a rumble pack is inserted.
*
(
nds)
Check if a rumble pack is inserted.
Void Rumble.set(status)
Void Rumble.set(status)* (_nds_)
Set the rumble status.
* *status* (Boolean): status of the rumble (
(
nds)
Set the rumble status.
- status (Boolean): status of the rumble (
true
true: ON,
: ON, false
false: OFF)
=== Motion ===
*
: OFF)
Boolean Motion.init
Boolean Motion.init* (_nds_)
Init the motion system if a motion device is detected. Return
(
nds)
Init the motion system if a motion device is detected. Return
true
true
if a motion device is detected.
*
if a motion device is detected.
Void Motion.calibrate
Void Motion.calibrate* (_nds_)
Calibrate the motion system.
*
(
nds)
Calibrate the motion system.
Number Motion.readX
Number Motion.readX* (_nds_)
Read the X tilt of the motion.
*
(
nds)
Read the X tilt of the motion.
Number Motion.readY
Number Motion.readY* (_nds_)
Read the Y tilt of the motion.
*
(
nds)
Read the Y tilt of the motion.
Number Motion.readZ
Number Motion.readZ* (_nds_)
Read the Z tilt of the motion.
*
(
nds)
Read the Z tilt of the motion.
Number Motion.accelerationX
Number Motion.accelerationX* (_nds_)
Read the X acceleration of the motion.
*
(
nds)
Read the X acceleration of the motion.
Number Motion.accelerationY
Number Motion.accelerationY* (_nds_)
Read the Y acceleration of the motion.
*
(
nds)
Read the Y acceleration of the motion.
Number Motion.accelerationZ
Number Motion.accelerationZ* (_nds_)
Read the Z acceleration of the motion.
*
(
nds)
Read the Z acceleration of the motion.
Number Motion.readGyro
Number Motion.readGyro* (_nds_)
Read the gyro value of the motion.
*
(
nds)
Read the gyro value of the motion.
Number Motion.rotation
Number Motion.rotation* (_nds_)
Read the rotation value of the motion.
=== DateTime ===
This should be DEPRECATED soon, as there is the
(
nds)
Read the rotation value of the motion.
This should be DEPRECATED soon, as there is the
os.date()
os.date()
basic Lua function.
*
basic Lua function.
DateTime DateTime.new()
DateTime DateTime.new()* (_libs_)
Create a new DateTime object.
*
(
libs)
Create a new DateTime object.
DateTime DateTime.getCurrentTime()
DateTime DateTime.getCurrentTime()* (_libs_)
Create a new DateTime object with current time values.
* *Attributes* (numbers):
*
(
libs)
Create a new DateTime object with current time values.
year
year,
, month
month,
, day
day,
, hour
hour,
, minute
minute,
, second
second*
* *NOTE*: See examples for more details.
=== Wifi ===
*
- NOTE: See examples for more details.
Void Wifi.connectWFC()
Void Wifi.connectWFC()* (_nds_)
Connect the DS to the Wifi connection. Use the firmware configurations. So, you need to configure your connection with an official DS game.
*
(
nds)
Connect the DS to the Wifi connection. Use the firmware configurations. So, you need to configure your connection with an official DS game.
Void Wifi.disconnect()
Void Wifi.disconnect()* (_nds_)
Disconnect the DS form the Wifi connection.
*
(
nds)
Disconnect the DS form the Wifi connection.
Socket Wifi.createTCPSocket(host, port)
Socket Wifi.createTCPSocket(host, port)* (_nds_)
Create a TCP socket on a server.
* *host* (String): hostname or IP adress of the server
* *port* (Number): port to use
*
(
nds)
Create a TCP socket on a server.
- host (String): hostname or IP adress of the server
- port (Number): port to use
Socket Wifi.createUDPSocket(host, port)
Socket Wifi.createUDPSocket(host, port)* (_nds_)
Create an UDP socket on a server.
* *host* (String): hostname or IP adress of the server
* *port* (Number): port to use
*
(
nds)
Create an UDP socket on a server.
- host (String): hostname or IP adress of the server
- port (Number): port to use
Void Wifi.closeSocket(socket)
Void Wifi.closeSocket(socket)* (_nds_)
Close a socket (TCP or UDP).
* *socket* (Socket): Socket to close
*
(
nds)
Close a socket (TCP or UDP).
- socket (Socket): Socket to close
Void Wifi.send(socket, buffer)
Void Wifi.send(socket, buffer)* (_nds_)
Send data to a server using a socket.
* *socket* (Socket): Socket to use
* *buffer* (String): data to send
*
(
nds)
Send data to a server using a socket.
- socket (Socket): Socket to use
- buffer (String): data to send
String Wifi.receive(socket, length)
String Wifi.receive(socket, length)* (_nds_)
Receive data from a server using a socket.
* *socket* (Socket): Socket to use
* *length* (Number): size of the data to receive
=== Sound ===
==== Sound banks ====
*
(
nds)
Receive data from a server using a socket.
- socket (Socket): Socket to use
- length (Number): size of the data to receive
Void Sound.loadBank(filename)
Void Sound.loadBank(filename)* (_nds_)
Load a soundbank from a file in memory.
* *filename* (String): path of the file to load
*
(
nds)
Load a soundbank from a file in memory.
- filename (String): path of the file to load
Void Sound.unloadBank()
Void Sound.unloadBank()* (_nds_)
Unload the sound bank from the memory.
==== Mods ====
*
(
nds)
Unload the sound bank from the memory.
Void Sound.loadMod(id)
Void Sound.loadMod(id)* (_nds_)
Load a module in memory.
* *id* (Number): id of the module to load
*
(
nds)
Load a module in memory.
- id (Number): id of the module to load
Void Sound.unloadMod(id)
Void Sound.unloadMod(id)* (_nds_)
Unload a module from the memory.
* *id* (Number): id of the module to unload
*
(
nds)
Unload a module from the memory.
- id (Number): id of the module to unload
Void Sound.startMod(id, playmode)
Void Sound.startMod(id, playmode)* (_nds_)
Start playing a module already loaded in memory.
* *id* (Number): id of the module to play
* *playmode* (Number): playing mode (
(
nds)
Start playing a module already loaded in memory.
- id (Number): id of the module to play
- playmode (Number): playing mode (
PLAY_ONCE
PLAY_ONCE or
or PLAY_LOOP
PLAY_LOOP)
*
)
Void Sound.pause()
Void Sound.pause()* (_nds_)
Pause all modules.
*
(
nds)
Pause all modules.
Void Sound.resume()
Void Sound.resume()* (_nds_)
Resume all modules.
*
(
nds)
Resume all modules.
Void Sound.stop()
Void Sound.stop()* (_nds_)
Stop all modules.
*
(
nds)
Stop all modules.
Void Sound.setPosition(id, position)
Void Sound.setPosition(id, position)* (_nds_)
Set the cursor position of a module.
* *id* (Number): id of the module
*
(
nds)
Set the cursor position of a module.
- id (Number): id of the module
Boolean Sound.isActive()
Boolean Sound.isActive()* (_nds_)
Return
(
nds)
Return
true
true
if the player is active and
if the player is active and
false
false
if it's not.
*
if it's not.
Void Sound.startJingle(id)
Void Sound.startJingle(id)* (_nds_)
Start playing a module as a jingle.
* *id* (Number): id of the module to play
*
(
nds)
Start playing a module as a jingle.
- id (Number): id of the module to play
Void Sound.setModVolume(volume)
Void Sound.setModVolume(volume)* (_nds_)
Set the volume of the played module.
* *volume* (Number): new volume value between 0 and 1024
*
(
nds)
Set the volume of the played module.
- volume (Number): new volume value between 0 and 1024
Void Sound.setJingleVolume(volume)
Void Sound.setJingleVolume(volume)* (_nds_)
Set the volume of the played jingle.
* *volume* (Number): new volume value between 0 and 1024
*
(
nds)
Set the volume of the played jingle.
- volume (Number): new volume value between 0 and 1024
Void Sound.setModTempo(tempo)
Void Sound.setModTempo(tempo)* (_nds_)
Set the tempo of the module player.
* *tempo* (Number): new tempo value between 512 and 2048
*
(
nds)
Set the tempo of the module player.
- tempo (Number): new tempo value between 512 and 2048
Void Sound.setModPitch(pitch)
Void Sound.setModPitch(pitch)* (_nds_)
Set the pitch of the module player.
* *pitch* (Number): new pitch value
==== SFX ====
*
(
nds)
Set the pitch of the module player.
- pitch (Number): new pitch value
Void Sound.loadSFX(id)
Void Sound.loadSFX(id)* (_nds_)
Load a SFX in the meory.
* *id* (Number): id of the SFX to load
*
(
nds)
Load a SFX in the meory.
- id (Number): id of the SFX to load
Void Sound.unloadSFX(id)
Void Sound.unloadSFX(id)* (_nds_)
Unload a SFX in the meory.
* *id* (Number): id of the SFX to unload
*
(
nds)
Unload a SFX in the meory.
- id (Number): id of the SFX to unload
Handle Sound.startSFX(id)
Handle 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 start
*
(
nds)
Start a sound effect already loaded in memory. Return and handle to this SFX.
- id (Number): id of the SFX to start
Void Sound.stopSFX(handle)
Void Sound.stopSFX(handle)* (_nds_)
Stop a played SFX.
* *handle* (Handle): handle of a SFX, given by the startSFX function
*
(
nds)
Stop a played SFX.
- handle (Handle): handle of a SFX, given by the startSFX function
Void Sound.releaseSFX(handle)
Void Sound.releaseSFX(handle)* (_nds_)
Mark an effect as low priority.
* *handle* (Handle): handle of a SFX, given by the startSFX function
*
(
nds)
Mark an effect as low priority.
- handle (Handle): handle of a SFX, given by the startSFX function
Void Sound.stopAllSFX()
Void Sound.stopAllSFX()* (_nds_)
Stop all payed SFX.
*
(
nds)
Stop all payed SFX.
Void Sound.setSFXVolume(handle, volume)
Void Sound.setSFXVolume(handle, volume)* (_nds_)
Set the volume of a playing SFX.
* *handle* (Handle): handle of a SFX, given by the startSFX function
* *volume* (Number): new volume value between 0 and 255 (different from Mods)
*
(
nds)
Set the volume of a playing SFX.
- handle (Handle): handle of a SFX, given by the startSFX function
- volume (Number): new volume value between 0 and 255 (different from Mods)
Void Sound.setSFXPanning(handle, panning)
Void Sound.setSFXPanning(handle, panning)* (_nds_)
Set the panning of a playing SFX.
* *handle* (Handle): handle of a SFX, given by the startSFX function
* *panning* (Number): new panning value between 0 (left) and 255 (right)
*
(
nds)
Set the panning of a playing SFX.
- handle (Handle): handle of a SFX, given by the startSFX function
- panning (Number): new panning value between 0 (left) and 255 (right)
Void Sound.setSFXPitch(handle, pitch)
Void Sound.setSFXPitch(handle, pitch)* (_nds_)
Set the pitch of a playing SFX.
* *handle* (Handle): handle of a SFX, given by the startSFX function
* *pitch* (Number): new pitch value
*
(
nds)
Set the pitch of a playing SFX.
- handle (Handle): handle of a SFX, given by the startSFX function
- pitch (Number): new pitch value
Void Sound.setSFXScalePitch(handle, scale)
Void Sound.setSFXScalePitch(handle, scale)* (_nds_)
Set the scaling pitch ratio of a playing SFX.
* *handle* (Handle): handle of a SFX, given by the startSFX function
* *scale* (Number): new scale pitch value
=== INI Files ===
*
(
nds)
Set the scaling pitch ratio of a playing SFX.
- handle (Handle): handle of a SFX, given by the startSFX function
- scale (Number): new scale pitch value
Table INI.load(filename)
Table INI.load(filename)* (_libs_)
Load an INI file and create a table with it.
* *filename* (String): file to load
*
(
libs)
Load an INI file and create a table with it.
- filename (String): file to load
Void INI.save(filename, tab)
Void INI.save(filename, tab)* (_libs_)
Save a table in an INI file.
* *filename* (String): file to load
* *tab* (Table): table to save
Example :
An INI file contains :
{{{
[infos]
name=toto
age=25
}}}
{{{
tab = INI.load(“myfile.ini”)
tab[“infos”][“name”] = “tata”
INI.save(“myfile.ini”, tab)
}}}
This exemple changes the line
(
libs)
Save a table in an INI file.
- filename (String): file to load
- tab (Table): table to save
Example :
An INI file contains :
[infos]
name=toto
age=25
infos
name=toto
age=25
}}}
tab = INI.load(“myfile.ini”)
tab[“infos”][“name”] = “tata”
INI.save(“myfile.ini”, tab)
tab = INI.load(“myfile.ini”)
tab[“infos”][“name”] = “tata”
INI.save(“myfile.ini”, tab)
}}}
This exemple changes the line
name=toto
name=toto
into
into
name=tata
name=tata
.
These tables can only contains Strings!!!
If you want to store integers convert them with the
.
These tables can only contains Strings!!!
If you want to store integers convert them with the
tostring()
tostring()
function!