@@ -80,7 +80,7 @@ This is done by first deleting the current `gmsv_holylib_linux[64].so` and then
8080
8181## Next Update
8282\- [ +] Any files in ` lua/autorun/_holylua/ ` are loaded by HolyLib on startup.<br >
83- \- [ +] Added a new modules ` luathreads ` , ` networkthreading ` , ` soundscape ` <br >
83+ \- [ +] Added a new modules ` luathreads ` , ` networkthreading ` , ` soundscape ` , ` luagc ` , ` nw2 ` <br >
8484\- [ +] Added ` NS_ ` enums to ` gameserver ` module.<br >
8585\- [ +] Added missing ` CNetChan:Shutdown ` function to the ` gameserver ` module.<br >
8686\- [ +] Added LZ4 compression for newly implemented net channel.<br >
@@ -176,6 +176,8 @@ https://github.com/RaphaelIT7/gmod-holylib/compare/Release0.7...main
176176\- [ +] Added ` directData ` argument to ` VoiceStream:GetData ` , ` VoiceStream:GetIndex ` , ` VoiceStream:SetIndex ` and ` VoiceStream:SetData ` <br >
177177\- [ +] Added overflow checks for ` gameserver.BroadcastMessage ` , ` CNetChan:SendMessage ` and ` CBaseClient:SendNetMsg ` when you try to use a overflowed buffer<br >
178178\- [ +] Added a few more arguments to ` HolyLib:OnPhysicsLag ` like ` phys1 ` , ` phys2 ` , ` recalcPhys ` , ` callerFunction ` and the arguments ` ent1 ` & ` ent2 ` were removed since you can call ` PhysObj:GetEntity ` <br >
179+ \- [ +] Added ` steamworks.GetGameServerSteamID ` to the ` steamworks ` module.<br >
180+ \- [ +] Added ` HolyLib:OnLuaRunString ` hook to the ` holylib ` module.<br >
179181\- [ #] Fixed ` addonsystem.ShouldMount ` & ` addonsystem.SetShouldMount ` ` workshopID ` arguments being a number when they should have been a string.<br >
180182\- [ #] Changed ` VoiceData:GetUncompressedData ` to now returns a statusCode/a number on failure instead of possibly returning a garbage string.<br >
181183\- [ #] Limited ` HttpServer:SetName ` to have a length limit of ` 64 ` characters.<br >
@@ -188,6 +190,8 @@ https://github.com/RaphaelIT7/gmod-holylib/compare/Release0.7...main
188190\- [ #] Changed arguments and return value of ` HolyLib:PostEntityConstructor ` <br >
189191\- [ #] Changed ` pvs.AddEntityToTransmit ` to only work inside ` HolyLib:PreCheckTransmit ` due to safety & performance reasons<br >
190192\- [ #] Changed ` HolyLib:[Pre/Post]CheckTransmit ` hooks to be disabled by default needing to be now enabled using ` pvs.Enable[Pre/Post]TransmitHook ` <br >
193+ \- [ #] Changed ` HttpServer:[Get/Put/Post/OtherShit] ` callback return value to be flipped, return ` false ` to mark a request as ` NOT ` handled, return ` true ` to mark it as handled<br >
194+ \- [ #] Fixed ` networking ` module partially not working without the ` pvs ` module - it internally had depended on it.<br >
191195\- [ -] Removed ` VoiceData:GetUncompressedData ` decompress size argument<br >
192196\- [ -] Removed ` CBaseClient:Transmit ` third argument ` fragments ` .<br >
193197\- [ -] Removed ` gameserver.CalculateCPUUsage ` and ` gameserver.ApproximateProcessMemoryUsage ` since they never worked.<br >
@@ -3897,12 +3901,16 @@ end, true)
38973901
38983902If you enable the IP Whitelist, only requests sent by connected players are processed.<br >
38993903
3900- #### HttpServer: Get (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3901- #### HttpServer: Put (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3902- #### HttpServer: Post (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3903- #### HttpServer: Patch (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3904- #### HttpServer: Delete (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3905- #### HttpServer: Options (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3904+ > [ !NOTE]
3905+ > If you return ` false ` you mark a request as ** not** handled.<br >
3906+ > This means that the delay will ** not** be responded to until you call ` HttpRequest:MarkHandled ` <br >
3907+
3908+ #### bool(handled) HttpServer: Get (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3909+ #### bool(handled) HttpServer: Put (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3910+ #### bool(handled) HttpServer: Post (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3911+ #### bool(handled) HttpServer: Patch (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3912+ #### bool(handled) HttpServer: Delete (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
3913+ #### bool(handled) HttpServer: Options (string path, function (HttpRequest, HttpResponse), bool ipWhitelist)
39063914
39073915### HttpRequest
39083916A incoming Http Request.
@@ -5183,6 +5191,126 @@ If enabled, some packets will be processed by the networking thread instead of t
51835191> [ !NOTE]
51845192> This can cause the ` HolyLib:ProcessConnectionlessPacket ` to not be called for the affected packets!
51855193
5194+ ## luagc
5195+
5196+ ### Functions
5197+
5198+ #### number luagc.GetGCCount(any targetObject = nil)
5199+ Returns the total count of GC objects.<br >
5200+ If given a ` targetObject ` object, it will count up all GCobjects until it reached the ` targetObject ` after which it'll stop.<br >
5201+ (the ` targetObject ` ** won't** be included in the result!)
5202+
5203+ #### table luagc.GetReferences(any object)
5204+ Returns a table containing ** all** GCObjects that have a reference stored to the given object.<br >
5205+
5206+ #### table luagc.GetContainingReferences(any object, bool recursive = false, table ignoreGCObjects = nil)
5207+ Returns all GCobjects that the given object stores.<br >
5208+ Can be recursive to include all GCobjects referenced by all child objects.<br >
5209+ ignoreGCObjects - A ** sequential** table inside which you can provide GC objects that should be ignored like the global table/` _G ` <br >
5210+
5211+ #### table luagc.GetAllGCObjects(any targetObject = nil)
5212+ Returns a table containing all GCobjects.<br >
5213+ If given a ` targetObject ` object, it will return all GCobjects until it reached the ` targetObject ` after which it'll stop.<br >
5214+ (the ` targetObject ` ** won't** be included in the result!)
5215+
5216+ The GClist ** always** goes from newest to oldest GCobjects due to how the GCobjects are chained.<br >
5217+
5218+ > [ !NOTE]
5219+ > This function itself create a table which is why doing<br >
5220+ > ` luagc.GetAllGCObjects(luagc.GetCurrentGCHeadObject()) ` <br >
5221+ > Will always have 1 object - which is the returned table.<br >
5222+ > You can do ` table.remove(gcList, 1) ` to remove the first entry to get rid of it.<br >
5223+
5224+ Example usage:
5225+ ``` lua
5226+ collectgarbage (" stop" ) -- to not modify gc list
5227+ local gcHead = luagc .GetCurrentGCHeadObject ()
5228+
5229+ function Example () -- 1 GCfunction
5230+ return {}
5231+ end
5232+ Example () -- Returns 1 GCtable
5233+ debug.setfenv (Example , {}) -- to avoid printing _G below - also creates 1 GCtable
5234+
5235+ -- Now print all new GC objects created by our code above
5236+ local gcList = luagc .GetAllGCObjects (gcHead )
5237+ table.remove (gcList , 1 ) -- remove the gcList table from itself since it included as the first entry.
5238+
5239+ for _ , gcObject in ipairs (gcList ) do
5240+ print (" object: " .. tostring (gcObject ) .. " (type: " .. type (gcObject ) .. " )" )
5241+ end
5242+ ```
5243+
5244+ Result:
5245+ ``` lua
5246+ object : table : 0xf0b9fdea (type : table )
5247+ object : table : 0xf09ffc3a (type : table )
5248+ object : function : 0xf0bf9cb2 (type : function )
5249+ ```
5250+
5251+ #### any luagc.GetCurrentGCHeadObject()
5252+ Returns the current GCobject that's at the head of the list.<br >
5253+
5254+ > [ !NOTE]
5255+ > The head object is ** always** the newest one.
5256+
5257+ #### table luagc.GetFormattedGCObjectInfo(any object)
5258+ Returns a nicely formatted table showing which fields store which GC references for the given object.<br >
5259+
5260+ > [ !NOTE]
5261+ > Fields are not consistent and can be ** nil** always check if a field exists!
5262+
5263+ Example:
5264+ ``` lua
5265+ function test ()
5266+ end
5267+ debug.setfenv (test , {hai = " :3" })
5268+
5269+ local formatted = luagc .GetFormattedGCObjectInfo (test )
5270+ PrintTable (formatted )
5271+ PrintTable (formatted .proto ) -- Let's also see the proto
5272+ ```
5273+
5274+ Output:
5275+ ``` lua
5276+ [" environment" ]:
5277+ [" hai" ] = :3
5278+ [" object" ] = function : 0xf09e29f2
5279+ [" proto" ] = proto : 0xf0898ae2
5280+ [" type" ] = function
5281+ [" upvalues" ]:
5282+
5283+ [" constants" ]:
5284+ [" name" ] = @lua_run
5285+ [" object" ] = proto : 0xefabbfb2
5286+ [" type" ] = proto
5287+ ```
5288+
5289+ #### number luagc.GetSizeOfGCObject(any object, bool recursive = false, table ignoreGCObjects = nil)
5290+ Returns the memory size of the given object.<br >
5291+ If recursive is set, then the size of referenced objects is added to the total result.<br >
5292+ ignoreGCObjects - A ** sequential** table inside which you can provide GC objects that should be ignored like the global table/` _G ` <br >
5293+
5294+ ## nw2
5295+ Simple purpose - to fix NW2Vars from breaking.<br >
5296+ This bug happens under the following scenario:<br >
5297+
5298+ An new entity spawns the ** first time** / no entity of it's class was created before.<br >
5299+ Then on this new entity - a NW2Var is set with it's creation.<br >
5300+
5301+ Now the issue is - when the engine packs the entity for networking, it'll store the packed data as the baseline.<br >
5302+ This ** includes** NW2Vars and this baseline is used for all entities of the same class meaning the NW2Var would be present for all of them.<br >
5303+ This storing into the base line ** only** happens once for the first time an entitiy was created - this is per entity class!<br >
5304+ (C++ entities - Lua's all share one class meaning this bug would apply a NW2Var to all of them!)<br >
5305+
5306+ Now what this module does - it prevents writing NW2Vars into the baseline ensuring they won't be applied to all entites of the same class.<br >
5307+
5308+ > [ !NOTE]
5309+ > The bug still exists clientside though seems to be rarer / variables don't seem to actually change?<br >
5310+ > There still seems to be invalid proxy calls though nothing much I can do about that.<br >
5311+ > This definetly needs more testing though it should be an improvement.<br >
5312+
5313+
51865314# Unfinished Modules
51875315
51885316## serverplugins
@@ -5199,6 +5327,12 @@ Supports: Linux32 | Linux64<br>
51995327> [ !NOTE]
52005328> Windows doesn't have plugins / we won't support it there.<br >
52015329
5330+ ## net
5331+ Was meant to provide extended functions like net.Seek and so on.
5332+
5333+ ## networkingreplacement
5334+ Will implement the entire packed entity code and snapshot stuff with our own implementation to hopefully achieve better performance.
5335+
52025336# Issues implemented / fixed
52035337` gameevent.GetListeners ` -> https://github.com/Facepunch/garrysmod-requests/issues/2377 <br >
52045338` stringtable.FindTable("modelprecache"):GetNumStrings() ` -> https://github.com/Facepunch/garrysmod-requests/issues/82 <br >
0 commit comments