util
util
This library is part of gmod but were extenting it.
See: https://wiki.facepunch.com/gmod/util
Methods
Compresses the given data async.
Instead of copying the given data, we keep a reference to it.
So don't modify it, while were compressing it!
So don't modify it, while were compressing it!
Decompresses the given data async.
Instead of copying the given data, we keep a reference to it.
So don't modify it, while were decompressing it!
So don't modify it, while were decompressing it!
Turns the given table into a json string just like util.FancyTableToJSON but it will do this on a different thread.
By giving the table to this function you make a promise to not modify the table while the json string is being created!
This is because we don't copy the table, we instead copy the pointer into a new Lua state where we then iterate/access it from another state/thread and if you modify it in any way you will experience a crash.
You still can access the table in that time, you are just not allowed to modify it.
It was observed that you can kinda modify the table though if you add new elements/the size of the table changes while its still creating the json string you will crash.
This function requires the luajit module to be enabled.
By giving the table to this function you make a promise to not modify the table while the json string is being created!
This is because we don't copy the table, we instead copy the pointer into a new Lua state where we then iterate/access it from another state/thread and if you modify it in any way you will experience a crash.
You still can access the table in that time, you are just not allowed to modify it.
It was observed that you can kinda modify the table though if you add new elements/the size of the table changes while its still creating the json string you will crash.
This function requires the luajit module to be enabled.
Compresses the given data using LZ4
Decompresses the given data using LZ4
Converts the json into a table like util.JSONToTable
This version is noticably faster than Gmod's version and uses less memory in the process.
This version is noticably faster than Gmod's version and uses less memory in the process.
It's util.TableToJSON but faster and it will turn numbers into integers if they fit as one.
This implementation will include null for values it cannot handle.
Gmod hides null but we don't meaning if for example we get {math.huge} as input, it will return [null] which still is valid json.
Gmod hides null but we don't meaning if for example we get {math.huge} as input, it will return [null] which still is valid json.