Skip to main content
Version: bleeding-edge 🩸


A table containing useful and aux functions.

👐Open Source
This structure is Open Sourced on GitHub. Feel free to make pull requests and suggest changes!
🗿Static Class
This is a Static Class. You can access it's methods directly with .. It is not possible to initialize or create new instances.

🎒 Examples

local table = {
"my_key" = 123,
[2] = "my_value"

local dump_text = NanosUtils.Dump(table)


-- Outputs Text
"my_key": 123,
2 = "my_value"
local arg1 = math.random()
local arg2 = math.random()

NanosUtils.Benchmark("My Heavy Operation", 1000, function(param1, param2)
-- Do some heavy operations here
local result = param1 * param2
end, arg1, arg2)

-- Outputs Text: 'Benchmark 'My Heavy Operation' (x1000) took 1.5ms.'

🗿 Static Functions

boolean IsEntityValidReturns if an entity is valid
string DumpDumps a table into a readable text
BenchmarkBenchmarks a function performance
string FormatStringA better string.format
table ShallowCopyTablePerforms a shallow copy of a table


Returns if an entity is valid

Returns boolean (if the entity is valid)
local ret = NanosUtils.IsEntityValid(entity)
any entityEntity to verify


Dumps a table into a readable text

Returns string (the table as readable text)
local ret = NanosUtils.Dump(table)
table tableTable to dump


Benchmarks a function performance, outputs in the console the elapsed time
NanosUtils.Benchmark(name, amount, func, args...)
string nameBenchmark name to output
number amountAmount of times to loop
function funcThe function to call
any args...The arguments of the function to call


A better string.format. replace {num} by the corresponding vararg in a string

Example: NanosUtils.FormatString("Hello {2} I'm {1}", "a noob", "world!") -- "Hello world! I'm a noob"

Returns string (the final text with the arguments)
local ret = NanosUtils.FormatString(text, args...)
string textText to format
any args...The arguments to replace


Performs a shallow copy of a table

Returns table (the copied table)
local ret = NanosUtils.ShallowCopyTable(table)
table tableThe table to shallow copy