Naev

Module luatk

Intersection of scissors with the current applied ones.

Functions

close () Closes the toolkit and all windows.
isOpen () Gets whether or not the luatk has a window open.
keypressed (key) Handles key presses.
luatk.Button:disable () Disables a button widget.
luatk.Button:enable () Enables a button widget.
luatk.Button:setAlt (alt) Sets the alt text of a button.
luatk.Text:dimensions () Gets the dimensions of the text widget text.
luatk.Text:height () Gets the height of the text widget text.
luatk.Text:set (text) Changes the text of the text widget.
luatk.Text:width () Gets the maximum width of the text widget text.
luatk.Window:destroy () Destroys a window.
luatk.Window:getDimensions () Gets the dimensions of the window.
luatk.Window:resize (w, h) Resizes the window, recentering if necessary.
luatk.Window:setAccept (func) Sets the accept function to be run when enter is pressed.
luatk.Window:setCancel (func) Sets the cancel function to be run when escape is pressed.
luatk.Window:setFocus (wgt) Sets the focused widget of a window.
luatk.Window:setFocusLock (state) Locks the focus for a window to whatever widget is being currently focused.
luatk.Window:setKeypress (func) Sets a function to handle key input to the window.
luatk.Window:setUpdate (f) Sets a custom function to be run each window update.
mousemoved (mx, my, dx, dy) Handles mouse motion.
mousepressed (mx, my, button) Handles mouse clicks.
mousereleased (mx, my, button) Handles mouse releases
newWindow (x, y, w, h) Creates a new window.
rerender () Forces the toolkit to rerender.
run () Runs the luatk.
setDefaultFont (font) Sets the default font to use for the toolkit.
textinput (str) Handles text input.
update (dt) Updates the luatk toolkit.
vn (setup) Creates a custom state inside a vn state.
wheelmoved (mx, my) Wheel moved event.


Functions

close ()
Closes the toolkit and all windows.
isOpen ()
Gets whether or not the luatk has a window open.
keypressed (key)
Handles key presses.

Parameters:

  • key

Returns:

    string key Name of the key pressed.
luatk.Button:disable ()
Disables a button widget.
luatk.Button:enable ()
Enables a button widget.
luatk.Button:setAlt (alt)
Sets the alt text of a button.

Parameters:

  • alt
luatk.Text:dimensions ()
Gets the dimensions of the text widget text.

Returns:

  1. number Width of the text in the widget.
  2. number Height of the text in the widget.
luatk.Text:height ()
Gets the height of the text widget text.

Returns:

    number Height of the text in the widget.
luatk.Text:set (text)
Changes the text of the text widget.

Parameters:

  • text string Text to set widget to.
luatk.Text:width ()
Gets the maximum width of the text widget text.

Returns:

    number Width of the text in the widget.
luatk.Window:destroy ()
Destroys a window.
luatk.Window:getDimensions ()
Gets the dimensions of the window.

Returns:

  1. number Width of the window.
  2. number Height of the window.
luatk.Window:resize (w, h)
Resizes the window, recentering if necessary.

Parameters:

  • w number Width to set the window to.
  • h number Height to set the window to.
luatk.Window:setAccept (func)
Sets the accept function to be run when enter is pressed.

Parameters:

  • func function Function to set.
luatk.Window:setCancel (func)
Sets the cancel function to be run when escape is pressed.

Parameters:

  • func function Function to set.
luatk.Window:setFocus (wgt)
Sets the focused widget of a window.

Parameters:

  • wgt Widget Widget to focus.
luatk.Window:setFocusLock (state)
Locks the focus for a window to whatever widget is being currently focused.

Parameters:

  • state boolean Whether to enable or disable the focus lock.
luatk.Window:setKeypress (func)
Sets a function to handle key input to the window.

Parameters:

  • func function Function to set.
luatk.Window:setUpdate (f)
Sets a custom function to be run each window update.

Parameters:

  • f function or nil Custom function to set. nil disables.
mousemoved (mx, my, dx, dy)
Handles mouse motion.

Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • mx number X coordinates of the mouse released position.
  • my number Y coordinates of the mouse released position.
  • dx number Relative X motion from last event.
  • dy number Relative Y motion from last event.

Returns:

    boolean true if the event was used, false otherwise.
mousepressed (mx, my, button)
Handles mouse clicks.

Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • mx number X coordinates of the mouse click.
  • my number Y coordinates of the mouse click.
  • button integer Number of the button pressed.

Returns:

    boolean true if the event was used, false otherwise.
mousereleased (mx, my, button)
Handles mouse releases Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • mx number X coordinates of the mouse released position.
  • my number Y coordinates of the mouse released position.
  • button integer Number of the button released.

Returns:

    boolean true if the event was used, false otherwise.
newWindow (x, y, w, h)
Creates a new window.

Parameters:

  • x number or nil X position of the window or nil to center.
  • y number or nil Y position of the window or nil to center.
  • w number Width to set the window to.
  • h number Height to set the window to.

Returns:

    luatk.Window A new luatk window.
rerender ()
Forces the toolkit to rerender.
run ()
Runs the luatk. Should be used after the windows are set up.
setDefaultFont (font)
Sets the default font to use for the toolkit.

Parameters:

  • font font Font to set as default.
textinput (str)
Handles text input.

Parameters:

  • str

Returns:

    string key Name of the key pressed.
update (dt)
Updates the luatk toolkit.

Only to be used when running the toolkit outside of luatk.run.

Parameters:

  • dt number Number of seconds since last update.
vn (setup)
Creates a custom state inside a vn state.

A full example is shown below. `` vn.clear() vn.scene() vn.transition() vn.na("This is a test") luatk.vn( function () local wdw = luatk.msgInput( "Test", "Just a test", 50, function( str )

  print( str )

end ) end ) vn.na("That was all!") vn.run() ``

Parameters:

  • setup function Function to set up the luatk.
wheelmoved (mx, my)
Wheel moved event.

Parameters:

  • mx number Mouse x wheel movement.
  • my number Mouse y wheel movement.
generated by LDoc 1.5.0 Last updated 2025-05-18 01:00:15