Class: MMOItemVariable


The MMOItemVariable class represents an MMOItem Variable, a custom value attached to an MMOItem inside an MMORoom.

MMOItem Variables behave exactly like User Variables, but can be updated or removed on the server side only.
They support basic data types and nested complex objects:

  • null
  • boolean
  • int (32 bit integer)
  • double (64 bit double precision number)
  • utf-string (UTF-8 encoded string, with length up to 32 KBytes)
  • SFSObject
  • SFSArray


See also


new MMOItemVariable(name, value [, type])

Creates a new MMOItemVariable instance.

Although the third parameter is optional, it is strongly recommended to use it. The reason is type autodetection of numbers (being integers or double precision numbers) may fail in some corner cases (for example n1 = Math.floor(100.0 - 99.0) will be treated as a double instead of an integer as expected).

Name Type Argument Default Description
name string The name of the MMOItem Variable.
value boolean | number | string | SFSObject | SFSArray The value of the MMOItem Variable; it can also be null.
type VariableType <optional>
null The type of the MMOItem Variable's value, among those listed in the VariableType enum; if null, type is autodetected.