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/00-misc/main.cpp | |
| parent | 0382bd8a03b82b9c154d896e819ee7fed24025eb (diff) | |
+ misc测试
Diffstat (limited to 'src/00-misc/main.cpp')
| -rw-r--r-- | src/00-misc/main.cpp | 43 |
1 files changed, 43 insertions, 0 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 |
