Skip to main content
Version: latest - a1.65.x ⚖️

NanosUtils

A table containing useful and aux functions.

🗿Static Class
This is a Static Class. Access it's methods directly with .. It's not possible to spawn new instances.
👐Open Source
This library implementation is Open Sourced on GitHub!
🧑‍💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!

🎒 Examples

(NanosUtils.Benchmark) Benchmarks a function
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 "Benchmark 'My Heavy Operation' (x1000) took 1.5ms"

🗿 Static Functions

ReturnsNameDescription
booleanIsEntityValidReturns if an entity is valid
BenchmarkBenchmarks a function performance

IsEntityValid

Returns if an entity is valid

— Returns boolean (if the entity is valid).

local ret = NanosUtils.IsEntityValid(entity)
TypeParameterDefaultDescription
anyentity Required parameter Entity to verify

Benchmark

Benchmarks a function performance, outputs in the console the elapsed time

NanosUtils.Benchmark(name, amount, func, args...)
TypeParameterDefaultDescription
stringname Required parameter Benchmark name to output
numberamount Required parameter Amount of times to loop
functionfunc Required parameter The function to call
anyargs... Required parameter The arguments of the function to call
NanosUtils.Benchmark Examples
Benchmarks a function
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 "Benchmark 'My Heavy Operation' (x1000) took 1.5ms"