From 695f88366e507032a3a9e1eb747cc48610a4cbe1 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 17 Sep 2019 08:30:49 +0800 Subject: =?UTF-8?q?+=E5=8D=8F=E7=A8=8B=E6=B1=A0=E3=80=81=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E3=80=81=E7=BA=BF=E7=A8=8B=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/01-coroutine/main.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/01-coroutine') diff --git a/src/01-coroutine/main.cpp b/src/01-coroutine/main.cpp index 7e711be..8187f6b 100644 --- a/src/01-coroutine/main.cpp +++ b/src/01-coroutine/main.cpp @@ -1,8 +1,5 @@ -extern "C" { -#include "../lua51/lua.h" -#include "../lua51/lualib.h" -#include "../lua51/lauxlib.h" -} +#include "../configure.h" +#if BUILD_TEST == TEST_1 #include #include @@ -48,14 +45,8 @@ luaL_reg fns[] = { void openlibs(lua_State* L) { luaL_openlibs(L); - //luaL_register(L, NULL, fns); - luaL_reg* fn; - int i = 0; - for (fn = &fns[0]; fn->name != 0; fn = &fns[++i]) - { - lua_pushcfunction(L, fn->func); - lua_setglobal(L, fn->name); - } + ///luaL_register(L, NULL, fns); + luax_registerglobal(L, fns); } int main(int args, char* argv[]) @@ -67,4 +58,6 @@ int main(int args, char* argv[]) lua_close(L); return 0; -} \ No newline at end of file +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0