Single parameter version of varargs

2024-05-09 Thread thedistantforest
Yep cool it seems to work. It also works with auto proc toIntSeq(a: auto): seq[int] = let a = a.toRange Run Though it would be nice to see the actual type on the function signature that like how `varargs[type, ...]` shows

Single parameter version of varargs

2024-05-09 Thread thedistantforest
Hi I just discovered the neat feature in nim of allowing conversions of parameters before it enters the actual proc. I'm curious however if there's a version of this that allows for a single parameter instead of an array of them? An example for anyone to play around with: proc toRa

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

Calling the generics parent function

2023-11-24 Thread thedistantforest
Oh that was easy! Thanks! Didn't occur to me that the square brackets explicitly calls the generic function (though it makes perfect sense now in hindsight). Thanks everyone for the help! Pretty cool that there are lots of solutions to this.

Calling the generics parent function

2023-11-24 Thread thedistantforest
Yes I was thinking of doing this if I didn't find any other way. I think it's not too bad of a solution as well.

Calling the generics parent function

2023-11-23 Thread thedistantforest
Hi I'm trying to run a proc that uses generics. There will be a general update[T] proc for normal use, and a specific proc for any custom code I would want to add. eg update[Enemy] for any enemy specific code. Here is a code example of what I mean: type EntGroup[T] = ref object