Skip to content

Commit 53ae764

Browse files
committed
lua: search for _holylib.lua on startup
1 parent 39397c5 commit 53ae764

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

source/lua.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ void Lua::Init(GarrysMod::Lua::ILuaInterface* LUA)
4949
g_Lua = LUA;
5050

5151
g_pModuleManager.LuaInit(false);
52+
53+
FileHandle_t fh = g_pFullFileSystem->Open("lua/autorun/server/_holylib.lua");
54+
if (fh)
55+
{
56+
int length = g_pFullFileSystem->Size(fh);
57+
char* buffer = new char[length + 1];
58+
g_pFullFileSystem->Read(buffer, length, fh);
59+
buffer[length] = 0;
60+
g_Lua->RunStringEx("_holylib.lua", "", buffer, true, true, true, true);
61+
delete[] buffer;
62+
g_pFullFileSystem->Close(fh);
63+
}
5264
}
5365

5466
void Lua::ServerInit()

0 commit comments

Comments
 (0)