Thread: luaindex type
View Single Post
05/11/14, 05:31 PM   #6
CatoTheElder
Join Date: May 2014
Posts: 44
Right, didn't realize it was open for edit.

Fair enough for being precise with type definitions, but in a perfect world, the function would take a standard type, run and return properly, even if it is not a global constant, or in a certain subset.

The specific function I was looking at is:
GetGuildId(luaindex index)
Returns: integer guildId

According to my testing, if you pass it a UINT32 in the range of 1..5, it returns what you pass it. If you pass a UINT32 above 5, it returns 0. Which is good, but seems rather impractical. Perhaps it will return 0 if there is no guild assigned to that index? I haven't been able to test that.

Cheers!
Cato
--

Geeky tech details for those interested:
UINT32 is an unsigned integer (positive number with no decimal places), with 32 bits of memory (RAM) allocated. This effectively provides a valid range of integers in the set 1..4294967296 Effects of going outside the range will vary based on the compiler used.

INT32 is a signed integer (negative or positive whole number with no decimal places), with 32 bits of memory allocated, with 1 reserved for the sign. This effectively provides a valid range of integers in the set -2147483648..2147483648

This is an extremely important distinction when working at bit level, as you cannot use 32 bit values, as 1 bit is reserved for the sign.

Quick ex:
(INT32) 1=0x10000000000000000000000000000001
(UINT32) 1=0x00000000000000000000000000000001
  Reply With Quote