File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,17 @@ TODO:
1313
1414## Main Functions
1515
16- #### HttpServer HttpServer : Create ()
16+ #### HttpServer httpserver. Create()
1717Creates a new HTTPServer.
1818
19- #### HttpServer : Destroy (HttpServer server)
19+ #### httpserver. Destroy(HttpServer server)
2020Destroys the given http server.
2121
22- ## Basic Functions
22+ #### (internal function) httpserver.Think()
23+ Runs ` HttpServer:Think() ` on all existing http servers.
24+ Called by the ` Think ` (` HTTPServer ` ) hook we add.
25+
26+ ## Class Functions
2327
2428#### HttpServer: Start (String IP, Number Port)
2529This will start or restart the HTTP Server, and it will listen on the given address + port.
Original file line number Diff line number Diff line change @@ -239,6 +239,14 @@ LUA_FUNCTION_STATIC(httpserver_Create)
239239 return 1 ;
240240}
241241
242+ LUA_FUNCTION_STATIC (httpserver_Think)
243+ {
244+ for (auto & [httpserver, _] : g_pPushedHttpServer)
245+ httpserver->Think ();
246+
247+ return 0 ;
248+ }
249+
242250LUA_FUNCTION_STATIC (httpserver_Destroy)
243251{
244252 HttpServer* pServer = Get_HttpServer (1 , true );
@@ -288,6 +296,7 @@ void LUA_InitServer(GarrysMod::Lua::ILuaBase* LUA)
288296 Util::StartTable ();
289297 Util::AddFunc (httpserver_Create, " Create" );
290298 Util::AddFunc (httpserver_Destroy, " Destroy" );
299+ Util::AddFunc (httpserver_Think, " Think" );
291300 Util::FinishTable (" httpserver" );
292301
293302 LUA->PushSpecial (GarrysMod::Lua::SPECIAL_GLOB);
You can’t perform that action at this time.
0 commit comments