NanosUtils
Eine Tabelle mit nützlichen und ergänzenden Funktionen
🎒 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
IsEntityValid: boolean | Gibt zurück, ob eine Entität gültig ist | |
Benchmark: number | Misst die Leistung einer Funktion |
IsEntityValidOptimal
Gibt zurück, ob eine Entität gültig ist
local ret = NanosUtils.IsEntityValid(entity)
Parameters
| Name | Type | Beschreibung |
|---|---|---|
entity | any | Die zu überprüfende Entität |
Returns
| Type | Beschreibung |
|---|---|
| boolean | ob die Entität gültig ist |
BenchmarkSlow
Misst die Leistung einer Funktion
It outputs the elapsed time in the console
local ret = NanosUtils.Benchmark(name, amount, func, args...)
Parameters
| Name | Type | Beschreibung |
|---|---|---|
name | string | Der Name des Benchmarks, der ausgegeben wird |
amount | number | Die Anzahl der Schleifendurchläufe |
func | function | Die aufzurufende Funktion |
args... | any | Die Argumente der aufzurufenden Funktion |
Returns
| Type | Beschreibung |
|---|---|
| number | Die vergangene Zeit in Millisekunden |
Examples (1)
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"

