Class SFS2X.Entities.Variables.BaseVariable

Base class for all SmartFoxServer Variable entities on the client.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new BaseVariable instance.

Field Summary

Method Summary

Class Detail

SFS2X.Entities.Variables.BaseVariable(name, value, type)
Creates a new BaseVariable instance.
Parameters:
{String} name
The name of the Variable.
{*} value
The value of the Variable; valid data types are: Boolean, Number, String, Object, Array. The value can also be null.
{Number} type Optional, Default: -1
The type id of the Variable among those available in the VariableType class. Usually it is not necessary to pass this parameter, as the type is auto-detected from the value.
See also:
SFS2X.Entities.Variables.VariableType

Field Detail

{String} name
Indicates the name of this variable.

NOTE: setting the name property manually on an existing Variable returned by the API has no effect on the server and can disrupt the API functioning. This property can be set when the Variable object is created using the constructor.

{*} value
Returns the value of this variable.

NOTE: setting the value property manually on an existing Variable returned by the API has no effect on the server and can disrupt the API functioning. This property can be set when the Variable object is created using the constructor.

Method Detail

  • {String} getTypeName(typeId)
    Indicates the type of this Variable. Possibly returned strings are: Null, Bool, Int, Double, String, Object, Array.
    Parameters:
    {Number} typeId
    The type id of the Variable among those available in the VariableType class.
    Returns:
    {String} The Variable type name.
  • {Boolean} isNull()
    Indicates if the Variable is null.
    Returns:
    {Boolean} true if the Variable has a null value.