mirror of
https://code.videolan.org/videolan/vlc
synced 2024-08-31 06:46:39 +02:00
lua_variables: allow the creation of a void variable.
This commit is contained in:
parent
962f19ece2
commit
efa1666ad3
@ -179,6 +179,9 @@ static int vlclua_var_create( lua_State *L )
|
||||
case LUA_TSTRING:
|
||||
i_type = VLC_VAR_STRING;
|
||||
break;
|
||||
case LUA_TNIL:
|
||||
i_type = VLC_VAR_VOID;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -186,6 +189,11 @@ static int vlclua_var_create( lua_State *L )
|
||||
int i_ret = var_Create( *pp_obj, psz_var, i_type );
|
||||
if( i_ret != VLC_SUCCESS )
|
||||
return vlclua_push_ret( L, i_ret );
|
||||
|
||||
// Special case for void variables
|
||||
if( i_type == VLC_VAR_VOID )
|
||||
return 0;
|
||||
|
||||
vlc_value_t val;
|
||||
vlclua_tovalue( L, i_type, &val );
|
||||
return vlclua_push_ret( L, var_Set( *pp_obj, psz_var, val ) );
|
||||
|
@ -388,7 +388,8 @@ var.get_list( object, name ): Get the object's variable "name"'s value list.
|
||||
1st return value is the value list, 2nd return value is the text list.
|
||||
var.set( object, name, value ): Set the object's variable "name" to "value".
|
||||
var.create( object, name, value ): Create and set the object's variable "name"
|
||||
to "value". Created vars can be of type float, string or bool.
|
||||
to "value". Created vars can be of type float, string, bool or void.
|
||||
For a void variable the value has to be 'nil'.
|
||||
|
||||
var.add_callback( object, name, function, data ): Add a callback to the
|
||||
object's "name" variable. Callback functions take 4 arguments: the
|
||||
|
Loading…
Reference in New Issue
Block a user