Reference pointers in GDScript?

Godot Version

4.2.1-stable or newer


what is the GDScript equivalent of setting up a reference pointer to a an arbitrary variable?
like this:

fn main() {
  let mut a: u8 = 10;
  let mut b: u8 = 30;

  let mut c = &mut a; assert!(c == a);   //`c` should point to `a`
  c += 10;            assert_eq!(a, 20); //`c` refers to `a`, so changes by `c` affects `a`
  c = &mut b;         assert!(c == b);   //`c` should now point to `b`
  c += 10;            assert_eq!(b, 40); //`c` refers to `b`, so changes by `c` affects `b`

while i know most Object assignments have this behavior of affecting eachother unless .duplicate() is invoked, i would like to intentionally provoke this behavior with primitive types and other components. any ideas?

I am not certain that GDS gives access to pointers directly (maybe?), but there is another layer of indirection you can use called ObjectID that represents the object as seen by the Engine.
The relevant functions are instance_from_id() (global scope) and Object.get_instance_id().
These IDs are ints, but they are not typed as pointers and have no safeties, so y’know, you’re on your own.