Type:RefID: Difference between revisions

From Resonite Wiki
Added a link. Also added a bit more to the description and a link as well.
m link to the To String node.
Tag: 2017 source edit
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
RefID is a wrapper type around a [[Type:ULong|ulong]] value which represents a pointer to a [[Type:IWorldElement|world element]].
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.


It uses it's last 2 bytes 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.


It is primarily an internal engine type and is not meant to be used directly.
=== term ===
A RefID is considered as "null" if and only if it's representation is equal to 0.


Many users eventually found that it is useful for [[Ref Hacking]], as this type is a reference to different parts of the engine ([[Slot|Slots]], [[Component|Components]], etc)
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: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