Lua: added sleep command

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1661 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-12-18 17:48:36 +00:00
parent 9b4be3abd1
commit 6e316937f4

View File

@ -949,6 +949,24 @@ int L_MessageBox(lua_State* L)
return 0;
}
int L_Sleep(lua_State* L)
{
int delay;
Uint32 end;
int nb_args=lua_gettop(L);
LUA_ARG_LIMIT (1, "sleep");
LUA_ARG_NUMBER(1, "sleep", delay, 0, 10000);
end = SDL_GetTicks()+delay;
do
{
Get_input(20);
} while (SDL_GetTicks()<end);
return 0;
}
// Handlers for window internals
T_Fileselector Scripts_list;
@ -1146,6 +1164,7 @@ void Run_script(char *scriptdir)
lua_register(L,"getsparecolor",L_GetSpareColor);
lua_register(L,"getsparetranscolor",L_GetSpareTransColor);
lua_register(L,"clearpicture",L_ClearPicture);
lua_register(L,"sleep",L_Sleep);
// For debug only