Tables

Provides utility functions for working with tables, including printing, copying, comparison, and value checking.


Accessing the Module

local TABLES <const> = exports.boii_utils:get("modules.tables")

Shared

Recursively prints the contents of a table to the console. Useful for debugging nested data.

Parameters

Name
Type
Description

t

table

The table to print

indent

string

(Optional) Indentation for nesting

Example

TABLES.print({ hello = "world", nested = { foo = true } })

table_contains(tbl, val)

Checks if a table contains a specific value.

Parameters

Name
Type
Description

tbl

table

Table to search in

val

any

Value to look for

Example


deep_copy(t)

Creates a deep copy of the given table.

Parameters

Name
Type
Description

t

table

Table to deep copy

Example


deep_compare(t1, t2)

Compares two tables deeply.

Parameters

Name
Type
Description

t1

table

First table

t2

table

Second table

Example


Notes

  • These functions work on both flat and nested tables.

  • deep_copy ensures references are not shared between the original and copied table.

  • deep_compare checks keys and values recursively.

Last updated