diff options
author | chai <chaifix@163.com> | 2018-12-30 18:55:10 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-30 18:55:10 +0800 |
commit | 880f7908a9cb2e3e4dde0874ece86b9c7ffc9963 (patch) | |
tree | e5b0b2a2e7b69a752e7c4ad272997974e83acfac | |
parent | b52e9430108f48c2f448cbe35f63b410181e31f3 (diff) |
-je_lua_embed.h
-rw-r--r-- | src/libjin-lua/je_lua_embed.h | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/libjin-lua/je_lua_embed.h b/src/libjin-lua/je_lua_embed.h deleted file mode 100644 index 1b1597c..0000000 --- a/src/libjin-lua/je_lua_embed.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __JIN_LUA_EMBED_H__ -#define __JIN_LUA_EMBED_H__ -#include <cstring> - -#include "common/je_lua.h" - -namespace JinEngine -{ - namespace Embed - { - - // Embed scripts. - #include "scripts/ai/state_machine.lua.h" - #include "scripts/graphics/graphics.lua.h" - #include "scripts/keyboard/keyboard.lua.h" - #include "scripts/mouse/mouse.lua.h" - #include "scripts/path/path.lua.h" - #include "scripts/time/time.lua.h" - #include "scripts/utils/json.lua.h" - #include "scripts/utils/xml.lua.h" - #include "scripts/log.lua.h" - #include "scripts/tiledmap/tiledmap.lua.h" - #include "scripts/physics/physics.lua.h" - - #include "scripts/app.lua.h" - - // Embed structure. - struct jin_Embed - { - const char* file, *source; - }; - - // In order. - static const jin_Embed modules[] = { - // ai - { "state_machine.lua", state_machine_lua }, - // keyboard - { "keyboard.lua", keyboard_lua }, - { "mouse.lua", mouse_lua }, - { "graphics.lua", graphics_lua }, - { "path.lua", path_lua }, - { "time.lua", time_lua }, - { "json.lua", json_lua }, - { "xml.lua", xml_lua }, - { "tiledmap.lua", tiledmap_lua }, - { "physics.lua", physics_lua }, - // - { "log.lua", log_lua }, - { 0, 0 } - }; - - static const jin_Embed bootscript = { "app.lua", app_lua }; - - static void run(lua_State* L) - { - jin_log_info("Load embeded scripts."); - const char* file, *source; - for (int i = 0; modules[i].file != 0; ++i) - { - file = modules[i].file; - source = modules[i].source; - jin_log_info("Embed script \"%s\".", file); - luax_clearstack(L); - if (luax_loadbuffer(L, source, strlen(source), file) == 0) - { - luax_call(L, 0, 0); - } - else - { - jin_log_error("Embed script \"%s\" failed.", file); - } - } - file = bootscript.file; - source = bootscript.source; - jin_log_info("Run boot script \"%s\".", file); - luax_clearstack(L); - if (luax_loadbuffer(L, source, strlen(source), file) == 0) - { - luax_call(L, 0, 0); - } - } - - } // namespace Embed -} // namespace JinEngine - -#endif // __JIN_LUA_EMBED_H__
\ No newline at end of file |