Shared

tableClone

fjsf.tableClone(sourceTable)

Creates a full deep copy of a table.

All nested tables are duplicated, cyclic references are handled safely, and the result is completely independent from the source table.

Parameters

  • sourceTable (table) β€” The table to be cloned

Returns

  • (table) β€” A deep-cloned copy of the source table

Example

local playerDataCopy = fjsf.tableClone(playerData)
playerDataCopy.money = 0 -- does not affect original table

tableMerge

fjsf.tableMerge(baseTable, mergeTable)

Recursively merges values from one table into another.

Nested tables are merged instead of overwritten, making this ideal for config overrides and defaults.

Parameters

  • baseTable (table) β€” The destination table

  • mergeTable (table) β€” The source table with new values

Returns

  • (table) β€” The merged table

Example


tableContains

Checks whether a table contains a specific value.

Intended for flat tables (non-nested), such as job lists, permissions, or allowed items.

Parameters

  • sourceTable (table) β€” The table to search

  • expectedValue (any) β€” The value to look for

Returns

  • (boolean) β€” Whether the value exists in the table

Example


tableFreeze

Creates a read-only version of a table.

Any attempt to modify the returned table will throw an error. Useful for protecting shared configuration data.

Parameters

  • originalTable (table) β€” The table to protect

Returns

  • (table) β€” A frozen, read-only proxy table

Example


tableFind

Searches for a value inside a table and returns the first matching key.

Useful when reverse-looking up values in configuration tables.

Parameters

  • searchTable (table) β€” The table to search in

  • searchValue (any) β€” The value to find

Returns

  • (any | nil) β€” The key associated with the value, or nil

Example


tableSize

Counts the number of key-value pairs in a table.

Works for non-array tables where the length operator (#) is unreliable.

Parameters

  • countTable (table) β€” The table to count

Returns

  • (number) β€” Number of entries in the table

Example


tableLowercaseKeys

Creates a new table where all string keys are converted to lowercase.

Useful for case-insensitive lookups (commands, identifiers, config keys).

Parameters

  • sourceTable (table) β€” The table to normalize

Returns

  • (table) β€” A new table with lowercase string keys

Example

tableMatches

Checks whether a table matches a given pattern table.

Only keys defined in the pattern table are validated. The source table may contain additional keys.

Nested tables are compared recursively.

Parameters

sourceTable (table) The table that is being validated.

matchTable (table) A pattern table defining required keys and values.

Returns

(boolean) Returns true if all values in matchTable exist and match in sourceTable.

Example


tableEquals

Checks whether two tables are strictly equal.

Both tables must contain the same keys and values. No extra or missing keys are allowed.

Nested tables are compared recursively.

Parameters

firstTable (table) The first table to compare.

secondTable (table) The second table to compare.

Returns

(boolean) Returns true if both tables are identical.

Example

Last updated