it'd be neat if it was possible to get the \ref (or tag) value of an object or path or any sort of data using a function, so it doesn't need to be an embedded text or anything.
ref() maybe
ID:2131573
![]() Aug 13 2016, 9:11 pm
|
|||||||
Resolved
| |||||||
![]() Aug 14 2016, 8:50 pm
|
|
I like this. It's on my list of possibilities for 512.
|
I think it would need to be a string because \ref will return the tag of an object, shouldn't it?
|
Can we make that optional? If I want to know something's tag, I'll just check the tag. If I want to know something's datatype/instance ID, I'll call ref().
|
Ter13 wrote:
Can we treat this as a number or does it HAVE to be a string? I think it has to be a string because of precision issues. Technically even the \ref macro's four-byte format is imprecise, since it cuts off an entire byte from the value to squeeze the type into the MSB. But with floating point numbers you end up with only three bytes of precision. I would quite like to ditch the tag behavior that \ref has currently anyway, though, because sometimes tags are a problem (as I found out in an SS13 report recently). Doing so in an explicit function call makes even more sense. |
while your making this a function, the ability to get the two pieces of info directly would also be nice.
typeid() and instanceid() or at the very least, typeid(). /tg/ has came in to a few cases where knowing that has been useful, and it would be nice to ditch the string parsing code we have to use |
I decided not to add a proc, but I changed the \ref macro behavior which I think is more important for a lot of projects.
|
I'd still really like ref() as a function just to avoid having to do string stuff.
|
#define ref(x) "\ref[x]"
or, if you want X.ref(): /datum/proc/ref() All a language-level `ref()` proc is going to do is give you the same string you'd get from `"\ref[x]"` anyway. |
GinjaNinja32 wrote:
sometimes i like to not touch the string table |
MrStonedOne wrote:
while your making this a function, the ability to get the two pieces of info directly would also be nice. |