Lua: added a message box. messagebox('message'), or messagebox('caption','message'). note that Lua supports concatenation (operator ..) and this function accepts backslash-n for carriage return. It performs word-wrapping if needed. Fixed the Hourglass cursor showing up in some error boxes, instead of the arrow cursor.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1340 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud
2010-02-13 19:00:13 +00:00
parent 683f8c6a18
commit 917847cdab
2 changed files with 34 additions and 1 deletions

View File

@@ -569,6 +569,32 @@ int L_InputBox(lua_State* L)
return 1 + nb_settings;
}
int L_MessageBox(lua_State* L)
{
int nb_args = lua_gettop (L);
const char * caption;
const char * message;
if (nb_args == 1)
{
caption = "Script message";
message = lua_tostring(L,1);
}
else if (nb_args == 2)
{
caption = lua_tostring(L,1);
message = lua_tostring(L,2);
}
else
{
return luaL_error(L, "MessageBox: Needs one or two arguments.");
}
Verbose_message(caption, message);
return 0;
}
// Handlers for window internals
T_Fileselector Scripts_list;
@@ -758,6 +784,7 @@ void Button_Brush_Factory(void)
lua_register(L,"matchcolor",L_MatchColor);
lua_register(L,"getbrushtransparentcolor",L_GetBrushTransparentColor);
lua_register(L,"inputbox",L_InputBox);
lua_register(L,"messagebox",L_MessageBox);
lua_register(L,"getforecolor",L_GetForeColor);
lua_register(L,"getbackcolor",L_GetBackColor);
lua_register(L,"gettranscolor",L_GetTransColor);