new function tpt.confirm (confirm prompt which returns true or false)
This commit is contained in:
parent
cd9d13503a
commit
fee8516157
@ -1691,6 +1691,16 @@ int luatpt_message_box(lua_State* l)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int luatpt_confirm(lua_State *l)
|
||||||
|
{
|
||||||
|
std::string title = std::string(luaL_optstring(l, 1, "Title"));
|
||||||
|
std::string message = std::string(luaL_optstring(l, 2, "Message"));
|
||||||
|
std::string buttonText = std::string(luaL_optstring(l, 3, "Confirm"));
|
||||||
|
bool ret = ConfirmPrompt::Blocking(title, message, buttonText);
|
||||||
|
lua_pushboolean(l, ret ? 1 : 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int luatpt_get_numOfParts(lua_State* l)
|
int luatpt_get_numOfParts(lua_State* l)
|
||||||
{
|
{
|
||||||
lua_pushinteger(l, luacon_sim->NUM_PARTS);
|
lua_pushinteger(l, luacon_sim->NUM_PARTS);
|
||||||
|
@ -106,6 +106,7 @@ int luatpt_register_mouseclick(lua_State* l);
|
|||||||
int luatpt_unregister_mouseclick(lua_State* l);
|
int luatpt_unregister_mouseclick(lua_State* l);
|
||||||
int luatpt_input(lua_State* l);
|
int luatpt_input(lua_State* l);
|
||||||
int luatpt_message_box(lua_State* l);
|
int luatpt_message_box(lua_State* l);
|
||||||
|
int luatpt_confirm(lua_State* l);
|
||||||
int luatpt_get_numOfParts(lua_State* l);
|
int luatpt_get_numOfParts(lua_State* l);
|
||||||
int luatpt_start_getPartIndex(lua_State* l);
|
int luatpt_start_getPartIndex(lua_State* l);
|
||||||
int luatpt_next_getPartIndex(lua_State* l);
|
int luatpt_next_getPartIndex(lua_State* l);
|
||||||
|
@ -180,6 +180,7 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
|||||||
{"unregister_keyevent", &luatpt_unregister_keypress},
|
{"unregister_keyevent", &luatpt_unregister_keypress},
|
||||||
{"input", &luatpt_input},
|
{"input", &luatpt_input},
|
||||||
{"message_box", &luatpt_message_box},
|
{"message_box", &luatpt_message_box},
|
||||||
|
{"confirm", &luatpt_confirm},
|
||||||
{"get_numOfParts", &luatpt_get_numOfParts},
|
{"get_numOfParts", &luatpt_get_numOfParts},
|
||||||
{"start_getPartIndex", &luatpt_start_getPartIndex},
|
{"start_getPartIndex", &luatpt_start_getPartIndex},
|
||||||
{"next_getPartIndex", &luatpt_next_getPartIndex},
|
{"next_getPartIndex", &luatpt_next_getPartIndex},
|
||||||
|
Reference in New Issue
Block a user