Using the var type to modify a separate object from another

2023-11-26 Thread Boston
This is the only way I know how to get the behavior you want, but I'm sure someone knows better. type Entity = ref object of RootObj rotation: int type Tweener = ref object of RootObj target: ptr int proc applyTween(t: Tweener, newValue: int) = t.t

Using the var type to modify a separate object from another

2023-11-26 Thread ElegantBeef
To do this safely one needs some form of borrow checker. Nim's experimental `views` does this but it's likely to be easier to just use a `ptr T` or `ref T` which ever suffices for your problem until that feature becomes more usable

Using the var type to modify a separate object from another

2023-11-26 Thread thedistantforest
Hi I'm trying to modify an object from the outside through another object. The reason for this is that I'd like a tween object to tween the variables of a target object. How would I achieve this? Example code: type Entity = ref object rotation: int type Tweener = ref