diff options
| author | chai <chaifix@163.com> | 2019-09-23 20:54:30 +0800 |
|---|---|---|
| committer | chai <chaifix@163.com> | 2019-09-23 20:54:30 +0800 |
| commit | 37c24268780d376cd72528c814260a192e61823e (patch) | |
| tree | f2210ffca4086a5cc664394e8629da4fa861eb82 /src | |
| parent | 0382bd8a03b82b9c154d896e819ee7fed24025eb (diff) | |
+ misc测试
Diffstat (limited to 'src')
| -rw-r--r-- | src/00-misc/main.cpp | 43 | ||||
| -rw-r--r-- | src/00-misc/misc.lua | 3 | ||||
| -rw-r--r-- | src/00-misc/vec.lua | 1 | ||||
| -rw-r--r-- | src/02-enum/main.cpp | 1 | ||||
| -rw-r--r-- | src/configure.h | 3 |
5 files changed, 50 insertions, 1 deletions
diff --git a/src/00-misc/main.cpp b/src/00-misc/main.cpp new file mode 100644 index 0000000..d55dac8 --- /dev/null +++ b/src/00-misc/main.cpp @@ -0,0 +1,43 @@ +#include "../configure.h" +#if BUILD_TEST == TEST_0 + +extern "C" { +#include "../lua51/lua.h" +#include "../lua51/lualib.h" +#include "../lua51/lauxlib.h" +} + +#include <windows.h> +#include <time.h> +#include <conio.h> + +luaL_reg fns[] = { + { 0, 0 } +}; + +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); + } +} + +int main(int args, char* argv[]) +{ + lua_State* L = luaL_newstate(); + openlibs(L); + + luaL_dofile(L, "00-misc/misc.lua"); + + lua_close(L); + getchar(); + return 0; +} + +#endif
\ No newline at end of file diff --git a/src/00-misc/misc.lua b/src/00-misc/misc.lua new file mode 100644 index 0000000..e73d2e3 --- /dev/null +++ b/src/00-misc/misc.lua @@ -0,0 +1,3 @@ +package.preload["00-misc.vec"] = loadfile("00-misc/vec.lua") + +require("00-misc.vec") diff --git a/src/00-misc/vec.lua b/src/00-misc/vec.lua new file mode 100644 index 0000000..2862a16 --- /dev/null +++ b/src/00-misc/vec.lua @@ -0,0 +1 @@ +print("vec.lua")
\ No newline at end of file diff --git a/src/02-enum/main.cpp b/src/02-enum/main.cpp index 172364b..c3914e7 100644 --- a/src/02-enum/main.cpp +++ b/src/02-enum/main.cpp @@ -36,6 +36,7 @@ int main(int args, char* argv[]) luaL_dofile(L, "02-enum/enum.lua"); lua_close(L); + getchar(); return 0; } diff --git a/src/configure.h b/src/configure.h index 6289d19..96e0142 100644 --- a/src/configure.h +++ b/src/configure.h @@ -1,6 +1,7 @@ #ifndef _CONFIGURE_H_ #define _CONFIGURE_H_ +#define TEST_0 0 #define TEST_1 1 #define TEST_2 2 #define TEST_3 3 @@ -13,7 +14,7 @@ #define TEST_10 10 -#define BUILD_TEST TEST_2 +#define BUILD_TEST TEST_0 //----------------------------------------------------------------------------------------------------- |
