mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Lua add S_MusicName
This commit is contained in:
parent
838d47acd3
commit
d9ab1e4424
1 changed files with 18 additions and 0 deletions
|
@ -2321,6 +2321,23 @@ static int lib_sMusicPaused(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sMusicName(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushstring(L, S_MusicName());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sMusicInfo(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
|
@ -3019,6 +3036,7 @@ static luaL_Reg lib[] = {
|
|||
{"S_MusicType",lib_sMusicType},
|
||||
{"S_MusicPlaying",lib_sMusicPlaying},
|
||||
{"S_MusicPaused",lib_sMusicPaused},
|
||||
{"S_MusicName",lib_sMusicName},
|
||||
{"S_MusicInfo",lib_sMusicInfo},
|
||||
{"S_MusicExists",lib_sMusicExists},
|
||||
{"S_GetMusicLength",lib_sGetMusicLength},
|
||||
|
|
Loading…
Reference in a new issue