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
Returns | Name | Description | |
---|---|---|---|
boolean | IsEntityValid | Returns if an entity is valid | |
Benchmark | Benchmarks a function performance |
IsEntityValid
Returns if an entity is valid
— Returns boolean (if the entity is valid).
local ret = NanosUtils.IsEntityValid(entity)
Type | Parameter | Default | Description |
---|---|---|---|
any | entity | Required parameter | Entity to verify |
Benchmark
Benchmarks a function performance, outputs in the console the elapsed time
NanosUtils.Benchmark(name, amount, func, args...)
Type | Parameter | Default | Description |
---|---|---|---|
string | name | Required parameter | Benchmark name to output |
number | amount | Required parameter | Amount of times to loop |
function | func | Required parameter | The function to call |
any | args... | 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"