Prints a value to the lua console.
@param data
— The data to print to the console.
function print(data: any)
-> nil
-- prints numbers
print(4)
print(0.42)
-- prints booleans
print(true)
print(false)
-- prints nil
print(nil)
-- prints strings
print("a string")
-- prints tables
print({
a = {
deeply = {
nested = "table",
},
},
})
-- prints multiple strings
print("string", "another string")
Stops script execution.
function stop()
-> nil
-- runs constantly
emu.atinterval(function()
print("Script is running!")
-- when the S key is pressed
if input.get().S then
-- stop the script
stop()
end
end)
This function is deprecated. See the api file for more details.
Displays the text message
in the console. Similar to print
, but only accepts strings or numbers. Also, emu.console
does not insert a newline character. Because of this, print
should be used instead.
@param message
— The string to print to the console.
function emu.console(message: string|number)
-> nil
---@diagnostic disable: deprecated
emu.console("some text\r\n")
emu.console(4)
Displays the text message
in the status bar on the bottom while replacing any other text. The message will only display until the next frame.
@param message
— The string to display on the status bar.
function emu.statusbar(message: string|number)
-> nil
emu.statusbar("a cool statusbar message")
emu.atinterval(function()
if input.get().N then
emu.statusbar("User just pressed the N key!")
end
end)
Calls the function f
every VI frame. For example, in Super Mario 64, the function will be called twice when you advance by one frame, whereas it will be called once in Ocarina of Time. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called every VI frame.
@param unregister
— If true, then unregister the function f
.
function emu.atvi(f: fun():nil, unregister?: boolean)
-> nil
-- runs 60 times per second on Super Mario 64
emu.atvi(function()
local vis = emu.framecount()
print("VI number " .. vis)
end)
Similar to emu.atvi
, but for drawing commands. ONLY GDI AND GDI+ COMMANDS WILL WORK HERE. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called after every VI frame.
@param unregister
— If true, then unregister the function f
.
function emu.atupdatescreen(f: fun():nil, unregister?: boolean)
-> nil
-- every screen update
emu.atupdatescreen(function()
-- draw a 30x30 red square at (10, 10)
wgui.fillrecta(10, 10, 30, 30, "red")
end)
Similar to emu.atvi
, but for all drawing commands. GDI and GDI+ commands will still work here, but it is recommended to put those in emu.atupdatescreen
If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called after every VI frame.
@param unregister
— If true, then unregister the function f
.
function emu.atdrawd2d(f: fun():nil, unregister?: boolean)
-> nil
Calls the function f
every input frame. The function f
receives an argument that seems to always be 0
. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function. Alias for joypad.register
.
@param f
— The function to be called every input frame. It receives an argument that seems to always be 0
.
@param unregister
— If true, then unregister the function f
.
function emu.atinput(f: fun(a?: integer):nil, unregister?: boolean)
-> nil
local counter = 0;
emu.atinput(function()
if counter % 2 == 0 then
joypad.set(1, {A = true})
end
counter = counter + 1
end)
Calls the function f
when the script is stopped. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called when the script is stopped.
@param unregister
— If true, then unregister the function f
.
function emu.atstop(f: fun():nil, unregister?: boolean)
-> nil
emu.atstop(function ()
end)
Defines a handler function that is called when a window receives a message. The only message that can be recieved is WM_MOUSEWHEEL for compatability. All other functionality as been deprecated. The message data is given to the function in 4 parameters. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you] never registered the function.
@param f
— The function to be called when a window message is received. a: wnd, b: msg, c: wParam, d: lParam.
@param unregister
— If true, then unregister the function f
.
function emu.atwindowmessage(f: fun(a: integer, b: integer, c: integer, d: integer):nil, unregister?: boolean)
-> nil
Calls the function f
constantly, even when the emulator is paused. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called constantly.
@param unregister
— If true, then unregister the function f
.
function emu.atinterval(f: fun():nil, unregister?: boolean)
-> nil
Calls the function f
when a movie is played. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called when a movie is played.
@param unregister
— If true, then unregister the function f
.
function emu.atplaymovie(f: fun():nil, unregister?: boolean)
-> nil
Calls the function f
when a movie is stopped. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called when a movie is stopped.
@param unregister
— If true, then unregister the function f
.
function emu.atstopmovie(f: fun():nil, unregister?: boolean)
-> nil
Calls the function f
when a savestate is loaded. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called when a savestate is loaded.
@param unregister
— If true, then unregister the function f
.
function emu.atloadstate(f: fun():nil, unregister?: boolean)
-> nil
Calls the function f
when a savestate is saved. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called when a savestate is saved.
@param unregister
— If true, then unregister the function f
.
function emu.atsavestate(f: fun():nil, unregister?: boolean)
-> nil
Calls the function f
when the emulator is reset. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called when the emulator is reset.
@param unregister
— If true, then unregister the function f
.
function emu.atreset(f: fun():nil, unregister?: boolean)
-> nil
Calls the function f
when seek is completed. If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called when the seek is completed.
@param unregister
— If true, then unregister the function f
.
function emu.atseekcompleted(f: fun():nil, unregister?: boolean)
-> nil
If unregister
is set to true, the function f
will no longer be called when this event occurs, but it will error if you never registered the function.
@param f
— The function to be called.
@param unregister
— If true, then unregister the function f
.
function emu.atwarpmodifystatuschanged(f: fun():nil, unregister?: boolean)
-> nil
Returns the number of VIs since the last movie was played. This should match the statusbar. If no movie has been played, it returns the number of VIs since the emulator was started, not reset.
@return framecount
— The number of VIs since the last movie was played.
function emu.framecount()
-> framecount: integer
Returns the number of input frames since the last movie was played. This should match the statusbar. If no movie is playing, it will return the last value when a movie was playing. If no movie has been played yet, it will return -1
.
@return samplecount
— The number of input frames since the last movie was played.
function emu.samplecount()
-> samplecount: integer
Returns the number of input frames that have happened since the emulator was started. It does not reset when a movie is started. Alias for joypad.count
.
@return inputcount
— The number of input frames that have happened since the emulator was started.
function emu.inputcount()
-> inputcount: integer
Returns the current mupen version. If type
is 0, it will return the full version name (Mupen 64 0.0.0). If type
is 1, it will return only the version number (0.0.0).
@param type
— Whether to get the full version (0
) or the short version (1
).
@return version
— The Mupen version.
type:
| 0
| 1
function emu.getversion(type: 0|1)
-> version: string
Pauses or unpauses the emulator.
@param pause
— True pauses the emulator and false resumes it.
function emu.pause(pause: boolean)
-> nil
Returns true
if the emulator is paused and false
if it is not.
@return emu_paused
— true
if the emulator is paused and false
if it is not.
function emu.getpause()
-> emu_paused: boolean
Returns the current speed limit (not the current speed) of the emulator.
@return speed_limit
— The current speed limit of the emulator.
function emu.getspeed()
-> speed_limit: integer
Sets the speed limit of the emulator.
@param speed_limit
— The new speed limit of the emulator.
function emu.speed(speed_limit: integer)
-> nil
Sets the speed mode of the emulator.
mode:
| "normal"
| "maximum"
function emu.speedmode(mode: "maximum"|"normal")
-> nil
Gets the address of an internal mupen variable. For example, "rdram" is the same as mupen's ram start
address:
| "rdram"
| "rdram_register"
| "MI_register"
| "pi_register"
| "sp_register"
| "rsp_register"
| "si_register"
| "vi_register"
| "ri_register"
| "ai_register"
| "dpc_register"
| "dps_register"
| "SP_DMEM"
| "PIF_RAM"
function emu.getaddress(address: "MI_register"|"PIF_RAM"|"SP_DMEM"|"ai_register"|"dpc_register"...(+9))
-> integer
Takes a screenshot and saves it to the directory dir
.
@param dir
— The directory to save the screenshot to.
function emu.screenshot(dir: string)
-> nil
Returns true
if the main mupen window is focused and false if it is not.
function emu.ismainwindowinforeground()
-> focused: boolean
Reinterprets the bits of a 4 byte integer n
as a float and returns it. This does not convert from an int to a float, but reinterprets the memory.
function memory.inttofloat(n: integer)
-> number
Reinterprets the bits of an 8 byte integer n
as a double and returns it. This does not convert from an int to a double, but reinterprets the memory.
function memory.inttodouble(n: integer[])
-> number
Reinterprets the bits of a float n
as a 4 byte integer and returns it. This does not convert from an int to a float, but reinterprets the memory.
function memory.floattoint(n: number)
-> integer
Reinterprets the bits of a 8 byte integer n
as a double and returns it. This does not convert from an int to a float, but reinterprets the memory.
function memory.doubletoint(n: integer[])
-> number
Takes in an 8 byte integer and returns it as a lua number. This function should only be used when reading a qword from memory.
function memory.qwordtonumber(n: integer[])
-> number
Reads a signed byte from memory at address
and returns it.
function memory.readbytesigned(address: integer)
-> integer
Reads an unsigned byte from memory at address
and returns it.
function memory.readbyte(address: integer)
-> integer
Reads a signed word (2 bytes) from memory at address
and returns it.
function memory.readwordsigned(address: integer)
-> integer
Reads an unsigned word (2 bytes) from memory at address
and returns it.
function memory.readword(address: integer)
-> integer
Reads a signed dword (4 bytes) from memory at address
and returns it.
function memory.readdwordsigned(address: integer)
-> integer
Reads an unsigned dword (4 bytes) from memory at address
and returns it.
function memory.readdword(address: integer)
-> integer
Reads a signed qword (8 bytes) from memory at address
and returns it as a table of the upper and lower 4 bytes.
function memory.readqwordsigned(address: integer)
-> integer[]
Reads an unsigned qword (8 bytes) from memory at address
and returns it as a table of the upper and lower 4 bytes.
function memory.readqword(address: integer)
-> integer
Reads a float (4 bytes) from memory at address
and returns it.
function memory.readfloat(address: integer)
-> number
Reads a double (8 bytes) from memory at address
and returns it.
function memory.readdouble(address: integer)
-> number
Reads size
bytes from memory at address
and returns them. The memory is treated as signed if size
is is negative.
size:
| 1
| 2
| 4
| 8
| -1
| -2
| -4
| -8
function memory.readsize(address: integer, size: -1|-2|-4|-8|1...(+3))
-> nil
Writes an unsigned byte to memory at address
.
function memory.writebyte(address: integer, data: integer)
-> nil
Writes an unsigned word (2 bytes) to memory at address
.
function memory.writeword(address: integer, data: integer)
-> nil
Writes an unsigned dword (4 bytes) to memory at address
.
function memory.writedword(address: integer, data: integer)
-> nil
Writes an unsigned qword consisting of a table with the upper and lower 4 bytes to memory at address
.
function memory.writeqword(address: integer, data: integer[])
-> nil
Writes a float to memory at address
.
function memory.writefloat(address: integer, data: number)
-> nil
Writes a double to memory at address
.
function memory.writedouble(address: integer, data: number)
-> nil
Writes size
bytes to memory at address
. The memory is treated as signed if size
is is negative.
size:
| 1
| 2
| 4
| 8
| -1
| -2
| -4
| -8
function memory.writesize(address: integer, size: -1|-2|-4|-8|1...(+3), data: integer|integer[])
-> nil
Sets the current GDI brush color to color
-- colors can be any of these or "#RGB", "#RGBA", "#RRGGBB", or "#RRGGBBA"
color:
| "white"
| "black"
| "clear"
| "gray"
| "red"
| "orange"
| "yellow"
| "chartreuse"
| "green"
| "teal"
| "cyan"
| "blue"
| "purple"
function wgui.setbrush(color: string|"black"|"blue"|"chartreuse"|"clear"...(+9))
GDI: Sets the current GDI pen color to color
-- colors can be any of these or "#RGB", "#RGBA", "#RRGGBB", or "#RRGGBBA"
color:
| "white"
| "black"
| "clear"
| "gray"
| "red"
| "orange"
| "yellow"
| "chartreuse"
| "green"
| "teal"
| "cyan"
| "blue"
| "purple"
function wgui.setpen(color: string|"black"|"blue"|"chartreuse"|"clear"...(+9), width?: number)
GDI: Sets the current GDI text color to color
-- colors can be any of these or "#RGB", "#RGBA", "#RRGGBB", or "#RRGGBBA"
color:
| "white"
| "black"
| "clear"
| "gray"
| "red"
| "orange"
| "yellow"
| "chartreuse"
| "green"
| "teal"
| "cyan"
| "blue"
| "purple"
function wgui.setcolor(color: string|"black"|"blue"|"chartreuse"|"clear"...(+9))
GDI: Sets the current GDI background color to color
-- colors can be any of these or "#RGB", "#RGBA", "#RRGGBB", or "#RRGGBBA"
color:
| "white"
| "black"
| "clear"
| "gray"
| "red"
| "orange"
| "yellow"
| "chartreuse"
| "green"
| "teal"
| "cyan"
| "blue"
| "purple"
function wgui.setbk(color: string|"black"|"blue"|"chartreuse"|"clear"...(+9))
Sets the font, font size, and font style
@param size
— The size of the font. Defaults to 0 if not given
@param font
— The name of the font from the operating system. Dafaults to "MS Gothic" if not given
@param style
— Each character in this string sets one style of the font, applied in chronological order. b
sets bold, i
sets italics, u
sets underline, s
sets strikethrough, and a
sets antialiased. Defaults to "" if not given
function wgui.setfont(size?: integer, font?: string, style?: string)
This function is deprecated. See the api file for more details.
GDI: Displays text in one line with the current GDI background color and GDI text color
function wgui.text(x: integer, y: integer, text: string)
GDI: Draws text in the specified rectangle and with the specified format.
@param text
— The text to be drawn.
@param rect
— The rectangle in which to draw the text.
@param format
— The format of the text. Applied in order stated. "l" aligns the text to the left (applied by default). "r" aligns the text to the right. "t" aligns text to the right (applied by default). "b" aligns text to the bottom. "c" horizontally aligns text. "v" vertically aligns the text. "e" adds ellipses if a line cannof fit all text. "s" forces text to be displayed on a single line.
function wgui.drawtext(text: string, rect: { l: integer, t: integer, r: integer, b: integer }|{ l: integer, t: integer, w: integer, h: integer }, format?: string)
This function is deprecated. See the api file for more details.
Uses an alternate function for drawing text.
function wgui.drawtextalt(text: string, format: integer, left: integer, top: integer, right: integer, bottom: integer)
Gets the width and height of the given text.
function wgui.gettextextent(text: string)
-> { width: integer, height: integer }
GDI: Draws a rectangle at the specified coordinates with the current GDI background color and a border of the GDI pen color. Only use this function if you need rounded corners, otherwise, use wgui.fillrecta
.
@param rounded_width
— The width of the ellipse used to draw the rounded corners.
@param rounded_height
— The height of the ellipse used to draw the rounded corners.
function wgui.rect(left: integer, top: integer, right: integer, bottom: integer, rounded_width?: integer, rounded_height?: integer)
This function is deprecated. See the api file for more details.
Draws a rectangle at the specified coordinates with the specified color.
function wgui.fillrect(left: integer, top: integer, right: integer, bottom: integer, red: integer, green: integer, blue: integer)
GDIPlus: Draws a rectangle at the specified coordinates, size and color.
@param color
— Color names are currently broken
-- colors can be any of these or "#RGB", "#RGBA", "#RRGGBB", or "#RRGGBBA"
color:
| "white"
| "black"
| "clear"
| "gray"
| "red"
| "orange"
| "yellow"
| "chartreuse"
| "green"
| "teal"
| "cyan"
| "blue"
| "purple"
function wgui.fillrecta(x: integer, y: integer, w: integer, h: integer, color: string|"black"|"blue"|"chartreuse"|"clear"...(+9))
GDIPlus: Draws an ellipse at the specified coordinates, size, and color
@param color
— Color names are currently broken
-- colors can be any of these or "#RGB", "#RGBA", "#RRGGBB", or "#RRGGBBA"
color:
| "white"
| "black"
| "clear"
| "gray"
| "red"
| "orange"
| "yellow"
| "chartreuse"
| "green"
| "teal"
| "cyan"
| "blue"
| "purple"
function wgui.fillellipsea(x: integer, y: integer, w: integer, h: integer, color: string|"black"|"blue"|"chartreuse"|"clear"...(+9))
Draws a filled in polygon using the points in points
@param points
— Ex: \{\{x1, y1\}, \{x2, y2\}, \{x3, y3\}\}
@param color
— Color names are currently broken
-- colors can be any of these or "#RGB", "#RGBA", "#RRGGBB", or "#RRGGBBA"
color:
| "white"
| "black"
| "clear"
| "gray"
| "red"
| "orange"
| "yellow"
| "chartreuse"
| "green"
| "teal"
| "cyan"
| "blue"
| "purple"
function wgui.fillpolygona(points: integer[][], color: string|"black"|"blue"|"chartreuse"|"clear"...(+9))
Loads an image file from path
and returns the identifier of that image
function wgui.loadimage(path: string)
-> integer
Clears one of all images
@param idx
— The identifier of the image to clear. If it is 0, clear all iamges
function wgui.deleteimage(idx: integer)
Draws the image at index idx
at the specified coordinates
function wgui.drawimage(idx: integer, x: integer, y: integer)
Draws the image at index idx
at the specified coordinates and scale
function wgui.drawimage(idx: integer, x: integer, y: integer, s: number)
Draws the image at index idx
at the specified coordinates and size
function wgui.drawimage(idx: integer, x: integer, y: integer, w: integer, h: integer)
Draws the image at index idx
at the specified coordinates, size, and rotation, using a part of the source image given by the src
parameters
function wgui.drawimage(idx: integer, x: integer, y: integer, w: integer, h: integer, srcx: integer, srcy: integer, srcw: integer, srch: integer, rotate: number)
Captures the current screen and saves it as an image
@return The
— identifier of the saved image
function wgui.loadscreen()
-> The: integer
Returns the width and height of the image at idx
function wgui.getimageinfo(idx: integer)
-> { width: integer, height: integer }
Draws an ellipse at the specified coordinates and size. Uses the GDI brush color for the background and a border of the GDI pen color
function wgui.ellipse(left: integer, top: integer, right: integer, bottom: integer)
Draws a polygon with the given points. Uses the GDI brush color for the background and a border of the GDI pen color
function wgui.polygon(points: integer[][])
Draws a line from (x1, y1)
to (x2, y2)
function wgui.line(x1: integer, y1: integer, x2: integer, y2: integer)
Returns the current width and height of the mupen window in a table
function wgui.info()
-> { width: integer, height: integer }
Sets a rectangle bounding box such that you cannot draw outside of it.
function wgui.setclip(x: integer, y: integer, w: integer, h: integer)
Creates a brush from a color and returns it. D2D colors range from 0 to 1
function d2d.create_brush(r: number, g: number, b: number, a: number)
-> integer
Frees a brush. It is a good practice to free all brushes after you are done using them
function d2d.free_brush(brush: integer)
Sets clear behavior. If this function is never called, the screen will not be cleared. If it is called, the screen will be cleared with the specified color
function d2d.clear(r: number, g: number, b: number, a: number)
Draws a filled in rectangle at the specified coordinates and color.
function d2d.fill_rectangle(x1: integer, y1: integer, x2: integer, y2: integer, brush: integer)
-> nil
Draws the border of a rectangle at the specified coordinates and color.
function d2d.draw_rectangle(x1: integer, y1: integer, x2: integer, y2: integer, thickness: number, brush: integer)
-> nil
Draws a filled in ellipse at the specified coordinates and color.
function d2d.fill_ellipse(x: integer, y: integer, radiusX: integer, radiusY: integer, brush: integer)
-> nil
Draws the border of an ellipse at the specified coordinates and color.
function d2d.draw_ellipse(x: integer, y: integer, radiusX: integer, radiusY: integer, thickness: number, brush: integer)
-> nil
Draws a line from (x1, y1)
to (x2, y2)
in the specified color.
function d2d.draw_line(x1: integer, y1: integer, x2: integer, y2: integer, thickness: number, brush: integer)
-> nil
Draws the text text
at the specified coordinates, color, font, and alignment.
@param fontstyle
— 0: normal, 1: bold, 2: italic, 3: bold + italic.
@param brush
— pass 0 if you don't know what you're doing
fontstyle:
| 0
| 1
| 2
| 3
function d2d.draw_text(x1: integer, y1: integer, x2: integer, y2: integer, text: string, fontname: string, fontsize: number, fontweight: number, fontstyle: 0|1|2|3, horizalign: integer, vertalign: integer, options: integer, brush: integer)
-> nil
Returns the width and height of the specified text.
function d2d.get_text_size(text: string, fontname: string, fontsize: number, max_width: number, max_height: number)
-> { width: integer, height: integer }
Specifies a rectangle to which all subsequent drawing operations are clipped. This clip is put onto a stack. It can then be popped off the stack with wgui.d2d_pop_clip
.
function d2d.push_clip(x1: integer, y1: integer, x2: integer, y2: integer)
-> nil
Draws a filled in rounded rectangle at the specified coordinates, color and radius.
function d2d.fill_rounded_rectangle(x1: integer, y1: integer, x2: integer, y2: integer, radiusX: number, radiusY: number, brush: integer)
-> nil
Draws the border of a rounded rectangle at the specified coordinates, color and radius.
function d2d.draw_rounded_rectangle(x1: integer, y1: integer, x2: integer, y2: integer, radiusX: number, radiusY: number, thickness: number, brush: integer)
-> nil
Loads an image file from path
which you can then access through identifier
.
function d2d.load_image(path: string)
-> integer
Draws an image by taking the pixels in the source rectangle of the image, and drawing them to the destination rectangle on the screen.
@param interpolation
— 0: nearest neighbor, 1: linear, -1: don't use.
function d2d.draw_image(destx1: integer, desty1: integer, destx2: integer, desty2: integer, srcx1: integer, srcy1: integer, srcx2: integer, srcy2: integer, opacity: number, interpolation: integer, identifier: number)
-> nil
Returns the width and height of the image at identifier
.
function d2d.get_image_info(identifier: number)
-> { width: integer, height: integer }
Sets the text antialiasing mode. More info here.
mode:
| 0
| 1
| 2
| 3
| 4294967295
function d2d.set_text_antialias_mode(mode: 0|1|2|3|4294967295)
Sets the antialiasing mode. More info here.
mode:
| 0
| 1
| 4294967295
function d2d.set_antialias_mode(mode: 0|1|4294967295)
Draws to an image and returns its identifier
function d2d.draw_to_image(width: integer, height: integer, callback: fun())
-> number
Returns the state of all keyboard keys and the mouse position in a table. Ex: input.get() -> {xmouse=297, ymouse=120, A=true, B=true}
.
function input.get()
-> table
Returns the differences between t1
and t2
. For example, if t1
is the inputs for this frame, and t2
is the inputs for last frame, it would return which buttons were pressed this frame, not which buttons are active.
function input.diff(t1: table, t2: table)
-> table
Opens a window where the user can input text. If OK
is clicked, that text is returned. If Cancel
is clicked or the window is closed, nil
is returned.
@param title
— The title of the text box. Defaults to "input:".
@param placeholder
— The text box is filled with this string when it opens. Defaults to "".
function input.prompt(title?: string, placeholder?: string)
-> string|nil
Gets the name of a key
function input.get_key_name_text(key: integer)
-> string
Gets the currently pressed game buttons and stick direction for a given port. Note that the y
coordinate of the stick is the opposite of what is shown on TAS Input.
port:
| 1
| 2
| 3
| 4
function joypad.get(port: 1|2|3|4)
-> table
Sets the current joypad to inputs
. If you do not specify one or more inputs, they will be set to false
for buttons or 0
for stick coordinates.
port:
| 1
| 2
| 3
| 4
function joypad.set(port: 1|2|3|4, inputs: table)
-> nil
Returns the number of input frames that have happened since the emulator was started. It does not reset when a movie is started. Alias for emu.inputcount
.
@return inputcount
— The number of input frames that have happened since the emulator was started.
function joypad.count()
-> inputcount: integer
Plays a movie file located at filename
. This function sets Read Only
to true.
function movie.play(filename: string)
-> nil
Returns the filename of the currently playing movie. It will error if no movie is playing.
function movie.get_filename()
-> string
Returns true if the currently playing movie is read only
function movie.get_readonly()
-> boolean
Set's the currently movie's readonly state to readonly
function movie.set_readonly(readonly: boolean)
Begins seeking
function movie.begin_seek(str: string, pause_at_end: boolean)
-> integer
Returns whether the emulator is currently seeking
function movie.is_seeking()
-> boolean
Gets info about the current seek
function movie.get_seek_completion()
-> [integer, integer]
Begins a warp modify
function movie.begin_warp_modify(inputs: { [string]: boolean }[])
Saves a savestate to filename
.
function savestate.savefile(filename: string)
-> nil
Loads a savestate from filename
function savestate.loadfile(filename: string)
-> nil
Opens a file dialouge and returns the file path of the file chosen.
@param filter
— This string acts as a filter for what files can be chosen. For example *.*
selects all files, where *.txt
selects only text files.
@param type
— Unknown.
function iohelper.filediag(filter: string, type: integer)
-> string
Begins an avi recording using the previously saved encoding settings. It is saved to filename
.
function avi.startcapture(filename: string)
-> nil