Commit 28f7de0f authored by nanahira's avatar nanahira

add Duel.LoadScript

parent 43002460
......@@ -393,6 +393,7 @@ static const struct luaL_Reg duellib[] = {
{ "MoveTurnCount", scriptlib::duel_move_turn_count },
{ "GetCardsInZone", scriptlib::duel_get_cards_in_zone },
{ "XyzSummonByRose", scriptlib::duel_xyz_summon_by_rose },
{ "LoadScript", scriptlib::duel_load_script },
{ "EnableGlobalFlag", scriptlib::duel_enable_global_flag },
{ "GetLP", scriptlib::duel_get_lp },
......
......@@ -197,6 +197,16 @@ int32 scriptlib::duel_xyz_summon_by_rose(lua_State *L) {
pduel->game_field->special_summon_rule(playerid, pcard, SUMMON_TYPE_XYZ);
return lua_yield(L, 0);
}
int32 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((char*) filename));
return 1;
}
int32 scriptlib::duel_enable_global_flag(lua_State *L) {
check_param_count(L, 1);
......
......@@ -37,6 +37,7 @@ public:
static int32 duel_move_turn_count(lua_State *L);
static int32 duel_get_cards_in_zone(lua_State *L);
static int32 duel_xyz_summon_by_rose(lua_State *L);
static int32 duel_load_script(lua_State *L);
//card lib
static int32 card_get_code(lua_State *L);
static int32 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