Skip to content

nut.menu

Library functions for nut.menu.

nut.menu is the interaction menu that appears when interacting with NS entities and characters.

Functions

nut.menu.add (options, position, onRemove)
nut.menu.add

Adds a new menu to the list of drawn menus.

Parameters:

table options Table of button text as keys and their callbacks as values

vararg position If Vector: Menu position, otherwise if Entiy: entity to position menu on

function onRemove optional Function to call after menu fades out

Returns:

number Index of the menu in the list

nut.menu.drawAll ()
nut.menu.drawAll

Draws all active menus or hides them when needed.

nut.menu.getActiveMenu ()
nut.menu.getActiveMenu

Determines which menu is being looked at.

Returns:

number Index of the active menu

function Callback of the currently hovered option

nut.menu.onButtonPressed (menu, callback)
nut.menu.onButtonPressed

Handles button press events for menus.

Parameters:

number menu The menu index

function callback Function to execute when pressed

Returns:

bool Whether the button was successfully pressed