Commit 698c519d authored by fallenstardust's avatar fallenstardust Committed by GitHub

Merge pull request #182 from jwyxym/master

update Duel.LoadScript
parents 6a3603b4 fc46f6fa
...@@ -13,6 +13,23 @@ ...@@ -13,6 +13,23 @@
#include "group.h" #include "group.h"
#include "ocgapi.h" #include "ocgapi.h"
#ifdef _IRR_ANDROID_PLATFORM_
int32_t scriptlib::duel_load_script(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_STRING, 1);
duel* pduel = interpreter::get_duel_info(L);
const char* pstr = lua_tostring(L, 1);
char filename[64];
sprintf(filename, "./script/%s", pstr);
lua_pushboolean(L, pduel->lua->load_script(filename));
return 1;
}
#endif
int32_t scriptlib::duel_enable_global_flag(lua_State *L) { int32_t scriptlib::duel_enable_global_flag(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
int32_t flag = (int32_t)lua_tointeger(L, 1); int32_t flag = (int32_t)lua_tointeger(L, 1);
...@@ -4839,6 +4856,10 @@ int32_t scriptlib::duel_majestic_copy(lua_State *L) { ...@@ -4839,6 +4856,10 @@ int32_t scriptlib::duel_majestic_copy(lua_State *L) {
} }
static const struct luaL_Reg duellib[] = { static const struct luaL_Reg duellib[] = {
#ifdef _IRR_ANDROID_PLATFORM_
{ "LoadScript", scriptlib::duel_load_script },
#endif
{ "EnableGlobalFlag", scriptlib::duel_enable_global_flag }, { "EnableGlobalFlag", scriptlib::duel_enable_global_flag },
{ "GetLP", scriptlib::duel_get_lp }, { "GetLP", scriptlib::duel_get_lp },
{ "SetLP", scriptlib::duel_set_lp }, { "SetLP", scriptlib::duel_set_lp },
......
...@@ -29,6 +29,10 @@ public: ...@@ -29,6 +29,10 @@ public:
static int32_t check_param_count(lua_State* L, int32_t count); static int32_t check_param_count(lua_State* L, int32_t count);
static int32_t check_action_permission(lua_State* L); static int32_t check_action_permission(lua_State* L);
#ifdef _IRR_ANDROID_PLATFORM_
static int32_t duel_load_script(lua_State *L);
#endif
//card lib //card lib
static int32_t card_get_code(lua_State *L); static int32_t card_get_code(lua_State *L);
static int32_t card_get_origin_code(lua_State *L); static int32_t card_get_origin_code(lua_State *L);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment