Skip to content

Commit

Permalink
Add NodeRef casts
Browse files Browse the repository at this point in the history
  • Loading branch information
psiberx committed Dec 30, 2024
1 parent 5842dc5 commit c1448bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/Utils/NodeRef.reds
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ public static native func CreateNodeRef(value: script_ref<String>) -> NodeRef
public static native func HashToNodeRef(value: Uint64) -> NodeRef
public static native func NodeRefToHash(value: NodeRef) -> Uint64

public static func ToNodeRef(value: script_ref<String>) -> NodeRef = CreateNodeRef(value)
public static func ToNodeRef(value: String) -> NodeRef = CreateNodeRef(value)
public static func ToNodeRef(value: Uint64) -> NodeRef = HashToNodeRef(value)

public static func Cast(value: NodeRef) -> Uint64 = NodeRefToHash(value)
public static func Cast(value: NodeRef) -> EntityID = EntityID.FromHash(NodeRefToHash(value))
public static func Cast(value: EntityID) -> NodeRef = HashToNodeRef(EntityID.ToHash(value))
public static func Cast(value: Uint64) -> NodeRef = HashToNodeRef(value)
public static func Cast(value: String) -> NodeRef = CreateNodeRef(value)

0 comments on commit c1448bf

Please sign in to comment.