Extensions - lnx00/Lmaobox-Library GitHub Wiki

These are extensions to add useful features which are missing in native Lua.

Extensions

Math

  • math.clamp(n, low, high) Clamps the value n between the given minimum and maximum values.
  • math.round(n) Rounds a number to the nearest integer.
  • math.lerp(a, b, t) Performs linear interpolation between two numbers.

Table

  • table.readOnly(t) Returns a read-only version of the given table.
  • table.find(t, value) Searches for the given value in the given table and returns its key.
  • table.contains(t, value) Checks if the given table contains the given value.

String

  • string.split(str, delimeter) Splits a string into a table of substrings based on a specified delimiter.