Commit efa1666a authored by Rémi Duraffort's avatar Rémi Duraffort

lua_variables: allow the creation of a void variable.

parent 962f19ec
......@@ -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
......
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