Module helpers

Contains helper functions for common tasks.

Info:

  • License: MIT
  • Author: Nomad Monad

Functions

string_join (sep) Return a function that joins a variable number of arguments, separated by the argument `sep` (default ', ').
console_msg (arg) Print to console and add new line separator.
print_func (sep) Return a print function that joins the arguments with a separator.
log_func (name, sep) Return a log function that prepends the current date and a name to the arguments.
log_once_func (name, sep) Return a log function that only logs each unique message once.
msg_box (msg, title, msgbox_type) Show a Message Box dialogue
iter (t) Create an iterator function for a table.
slice_table (source_table, start_idx, end_idx) Slice a table.
file_exists (fpath) Check if a file exists.
read_file (fpath) Read a file.

Constants

MsgBoxTypes Constants for message box types.


Functions

string_join (sep)
Return a function that joins a variable number of arguments, separated by the argument `sep` (default ', ').

Parameters:

  • sep string

Returns:

    function
console_msg (arg)
Print to console and add new line separator.

Parameters:

  • arg
print_func (sep)
Return a print function that joins the arguments with a separator.

Parameters:

  • sep string Default is ', '

Returns:

    function
log_func (name, sep)
Return a log function that prepends the current date and a name to the arguments.

Parameters:

  • name string
  • sep string Default is ' --- '

Returns:

    function
log_once_func (name, sep)
Return a log function that only logs each unique message once. Useful for preventing console spam in loops or frequent function calls.

Parameters:

  • name string Logger name
  • sep string Default is ' --- '

Returns:

    function Logger function that tracks logged messages
msg_box (msg, title, msgbox_type)
Show a Message Box dialogue

Parameters:

  • msg string
  • title number
  • msgbox_type number helpers.MsgBoxTypes

Returns:

    number

See also:

iter (t)
Create an iterator function for a table. https://www.lua.org/pil/7.1.html

Parameters:

  • t table

Returns:

    function
slice_table (source_table, start_idx, end_idx)
Slice a table.

Parameters:

  • source_table table
  • start_idx number
  • end_idx number

Returns:

    table
file_exists (fpath)
Check if a file exists.

Parameters:

  • fpath string

Returns:

    boolean
read_file (fpath)
Read a file. Return the content as a string. If the file does not exist, throw an error.

Parameters:

  • fpath string

Returns:

    string

Constants

MsgBoxTypes
Constants for message box types.

Fields:

  • OK number
  • OKCANCEL number
  • ABORTRETRYIGNORE number
  • YESNOCANCEL number
  • YESNO number
  • RETRYCANCEL number
generated by LDoc 1.5.0 Last updated 2026-01-17 13:27:25