From 984391bed5977a3bc5b0d7c2e0c4f0e0f7b05875 Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Sat, 8 Oct 2022 12:58:16 +0800 Subject: [PATCH] Rename love::luasocket::__open to love::luasocket::preload --- src/libraries/luasocket/luasocket.cpp | 11 +---------- src/libraries/luasocket/luasocket.h | 2 +- src/modules/love/love.cpp | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/libraries/luasocket/luasocket.cpp b/src/libraries/luasocket/luasocket.cpp index 7967c2aed..bcdb582ff 100644 --- a/src/libraries/luasocket/luasocket.cpp +++ b/src/libraries/luasocket/luasocket.cpp @@ -38,15 +38,6 @@ extern "C" { #include "libluasocket/tp.lua.h" #include "libluasocket/url.lua.h" -// Quick macro for adding functions to -// the preloder. -#define PRELOAD(name, function) \ - lua_getglobal(L, "package"); \ - lua_getfield(L, -1, "preload"); \ - lua_pushcfunction(L, function); \ - lua_setfield(L, -2, name); \ - lua_pop(L, 2); - static void preload(lua_State* L, const char* name, lua_CFunction func) { lua_getglobal(L, "package"); @@ -88,7 +79,7 @@ namespace love namespace luasocket { -int __open(lua_State * L) +int preload(lua_State * L) { // Preload code from LuaSocket. diff --git a/src/libraries/luasocket/luasocket.h b/src/libraries/luasocket/luasocket.h index 2ce9c5a83..c8e50c0db 100644 --- a/src/libraries/luasocket/luasocket.h +++ b/src/libraries/luasocket/luasocket.h @@ -29,7 +29,7 @@ namespace love namespace luasocket { -int __open(lua_State * L); +int preload(lua_State * L); } // luasocket } // love diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index 6df24c6d6..ab511a05e 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -652,7 +652,7 @@ int luaopen_love(lua_State *L) #endif #ifdef LOVE_ENABLE_LUASOCKET - love::luasocket::__open(L); + love::luasocket::preload(L); #endif #ifdef LOVE_ENABLE_ENET love::luax_preload(L, luaopen_enet, "enet");