Commit 6da72c20 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

lua: move some code, no functional changes

parent 8c5e52f4
...@@ -42,18 +42,19 @@ ...@@ -42,18 +42,19 @@
#include "../vlc.h" #include "../vlc.h"
#include "../libs.h" #include "../libs.h"
#include "misc.h"
/***************************************************************************** /*****************************************************************************
* Internal lua<->vlc utils * Internal lua<->vlc utils
*****************************************************************************/ *****************************************************************************/
static void vlclua_set_object( lua_State *L, void *id, void *value ) void vlclua_set_object( lua_State *L, void *id, void *value )
{ {
lua_pushlightuserdata( L, id ); lua_pushlightuserdata( L, id );
lua_pushlightuserdata( L, value ); lua_pushlightuserdata( L, value );
lua_rawset( L, LUA_REGISTRYINDEX ); lua_rawset( L, LUA_REGISTRYINDEX );
} }
static void *vlclua_get_object( lua_State *L, void *id ) void *vlclua_get_object( lua_State *L, void *id )
{ {
lua_pushlightuserdata( L, id ); lua_pushlightuserdata( L, id );
lua_rawget( L, LUA_REGISTRYINDEX ); lua_rawget( L, LUA_REGISTRYINDEX );
...@@ -73,16 +74,6 @@ vlc_object_t * vlclua_get_this( lua_State *L ) ...@@ -73,16 +74,6 @@ vlc_object_t * vlclua_get_this( lua_State *L )
return vlclua_get_object( L, vlclua_set_this ); return vlclua_get_object( L, vlclua_set_this );
} }
void vlclua_set_playlist_internal( lua_State *L, playlist_t *pl )
{
vlclua_set_object( L, vlclua_set_playlist_internal, pl );
}
playlist_t *vlclua_get_playlist_internal( lua_State *L )
{
return vlclua_get_object( L, vlclua_set_playlist_internal );
}
/***************************************************************************** /*****************************************************************************
* VLC error code translation * VLC error code translation
*****************************************************************************/ *****************************************************************************/
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#ifndef VLC_LUA_MISC_H #ifndef VLC_LUA_MISC_H
#define VLC_LUA_MISC_H #define VLC_LUA_MISC_H
void vlclua_set_object( lua_State *, void *id, void *value );
void *vlclua_get_object( lua_State *, void *id );
vlc_object_t * vlclua_get_this( lua_State * ); vlc_object_t * vlclua_get_this( lua_State * );
int vlclua_push_ret( lua_State *, int ); int vlclua_push_ret( lua_State *, int );
......
...@@ -41,6 +41,17 @@ ...@@ -41,6 +41,17 @@
#include "../libs.h" #include "../libs.h"
#include "input.h" #include "input.h"
#include "variables.h" #include "variables.h"
#include "misc.h"
void vlclua_set_playlist_internal( lua_State *L, playlist_t *pl )
{
vlclua_set_object( L, vlclua_set_playlist_internal, pl );
}
playlist_t *vlclua_get_playlist_internal( lua_State *L )
{
return vlclua_get_object( L, vlclua_set_playlist_internal );
}
static int vlclua_playlist_prev( lua_State * L ) static int vlclua_playlist_prev( lua_State * L )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment