Type:RefID: Difference between revisions

From Resonite Wiki
m cat
m link to the To String node.
Tag: 2017 source edit
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
The '''RefID''' type is a wrapper around a [[Type:ULong|ulong]] value which represents a pointer to a [[Type:IWorldElement|world element]]. Every IWorldElement stores a unique RefID as its <code>ReferenceID</code> field. It is primarily an internal engine type and is not meant to be used directly.
The '''RefID''' type is a wrapper around a [[Type:ULong|ulong]] value which represents a pointer to a [[Type:IWorldElement|world element]]. Every [[Type:IWorldElement]] stores a unique RefID as its <code>ReferenceID</code> field. It is primarily an internal engine type and is not meant to be used directly.


RefIDs use their final byte to represent the allocation id of a user who allocated the world element, and the remaining bytes are used to represent which world element it's pointing to.
== Internal mechanism ==
RefIDs use their least significant byte to represent the allocation id of a user who allocated the world element, and the remaining bytes are used to represent which world element it's pointing to.
 
=== term ===
A RefID is considered as "null" if and only if it's representation is equal to 0.
 
RefIDs are considered as "equal" if and only if their representation is equal.
 
A RefID is considered as "local" if and only if "user allocation id" is 255.
 
=== Stringify format ===
A RefID is converted [[ProtoFlux:To String|to string]] which value is hexadecimal representation value followed by a fixed string <code>ID</code>.
 
Example: <code>IDA1B2C3D4</code>.
 
== See also ==
* [[Ref Hacking]] - unsupported way to achieve flexible operation on components


[[Category:Type]]
[[Category:Type]]
[[Category:Value types]]
[[Category:Value types]]

Latest revision as of 13:13, 26 April 2025

The RefID type is a wrapper around a ulong value which represents a pointer to a world element. Every Type:IWorldElement stores a unique RefID as its ReferenceID field. It is primarily an internal engine type and is not meant to be used directly.

Internal mechanism

RefIDs use their least significant byte to represent the allocation id of a user who allocated the world element, and the remaining bytes are used to represent which world element it's pointing to.

term

A RefID is considered as "null" if and only if it's representation is equal to 0.

RefIDs are considered as "equal" if and only if their representation is equal.

A RefID is considered as "local" if and only if "user allocation id" is 255.

Stringify format

A RefID is converted to string which value is hexadecimal representation value followed by a fixed string ID.

Example: IDA1B2C3D4.

See also

  • Ref Hacking - unsupported way to achieve flexible operation on components