Thread Tools Display Modes
05/11/14, 01:38 AM   #1
CatoTheElder
Join Date: May 2014
Posts: 44
luaindex type

So, after about half dozen posts, I remembered I came here to ask about the luaindex type. I'm about 98% sure someone made that up, and I don't know what in the flying **** I need to pass. I tried the string 'skooma', but it didn't like that ... I know all about arrays, tables, items, and indices, so please don't give me some generic explanation about an index.

Specifically, the lua part of luaindex. Is it looking for an index to correlate to the array/table/object that holds .... the path to the lua compiler?!

If anyone could explain anything about it, I would greatly appreciate it.

Last edited by CatoTheElder : 05/11/14 at 01:42 AM. Reason: clarify my exasperation
  Reply With Quote
05/11/14, 01:51 AM   #2
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
It's just a number. I think they call it luaindex becase lua recommends using 1 for first item index in table/string etc. So it's there for you to know to no to pass 'skooma' or -10, just a number in the range 1...n.
  Reply With Quote
05/11/14, 02:17 AM   #3
CatoTheElder
Join Date: May 2014
Posts: 44
So, it should read 'UINT32'. I'm pretty sure someone screwed up id and index on the API page. OTL

WTB edit permissions, PST
  Reply With Quote
05/11/14, 10:34 AM   #4
skyraker
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 154
I tend to like using luaindex when I want to reference a number that is converted to a game constant (like player status conditions). It may not be the best name, but in my mind I've always felt a need to distinguish between a pure integer parameter and a very specific subset.
  Reply With Quote
05/11/14, 11:35 AM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
The term "luaindex" is what was in the original, official docs provided by ZOS.

Yes, it is a number. It is different from "integer" in that it cannot be negative.

It's a wiki - anyone can edit it, so long as you don't screw things up.
  Reply With Quote
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

ESOUI » AddOns » AddOn Help/Support » luaindex type


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off