Lua add S_MusicName

This commit is contained in:
mazmazz 2018-08-25 08:03:23 -04:00
parent 838d47acd3
commit d9ab1e4424

View file

@ -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},