Engine object handles

Posted By: Saturnus

Engine object handles - 01/14/10 22:32

In my opinion it's somewhat confusing that the handle returned by handle() is of type var, while the return value actually represents a long integer.

Converting handles into other data types doesn't seem to work because of that.
E.g. (long)handle(ent) returns a wrong value. Additionally handles can't be converted into STRINGs via str_for_num() and they can't be written into files via file_var_write(). In all cases the converted handles read as "65536" instead.

The best workaround I've found so far is using memcpy() to copy the var handle into a long. Then it's also possible to convert it into a STRING using str_for_int().

Perhaps the manual should give a hint about this.
Posted By: jcl

Re: Engine object handles - 01/15/10 09:44

Handles are precisely described in the manual under "handle()" - read this when you want to convert them.
© 2024 lite-C Forums