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. |
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.
|
So, it should read 'UINT32'. I'm pretty sure someone screwed up id and index on the API page. OTL
WTB edit permissions, PST |
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.
|
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. ;) |
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 |
Hey, there is no uint32 in lua. There is only one numerical type called number and it is 64bit double precision floating point number.
BTW, 32 bit integer range is signed :-2147483648 to 2147483647, and unsigned: 0 to 4294967295. |
Quote:
So, back to my original point - no 'luaindex'. There is no unit32 in lua, but there is in C, which is what we're using the LUA scripting language to interact with. The application is 32 bit, so I wouldn't try passing a 64-bit value to a 32-bit application. You're right about the integer ranges, good catch. I haven't used 0 as an integer in years. Its far more efficient to type it as a boolean/bit and save the other 31/63 bits :) |
hmm ESO does have a 64 bit value though if I am understanding the timestamp value correctly.
GetTimeStamp() Returns: id64 timestamp I may be misunderstanding as that technically could be a 32 bit positive number. |
Quote:
|
I use it in my gatherer addon as a unique timestamp as it is unlikely that you can loot from 2 nodes at the same time. Or that two people can gather from the same node in less than a second in the case of imported data.
An example number is : 1399157248. There isn't a function to extract both the date and time from it within the ESO functions, only the date. |
Quote:
Code:
#include <stdio.h> Code:
[harven@fedora-arm test]$ ./bittest Lua Code:
Code:
1.844674407371e+019 type: number Code:
typedef double luaindex |
Quote:
Anyways, yes... a lot of systems easily work around the "max size" problem these days. memalloc in stdlib has been through a lot of upgrades. I suppose I don't trust them due to headaches from the early days of 64-bit PCs. You can certainly do it, it will probably be okay. I just meant to say, I personally avoid it if at all possible. I get the point about the 'luaindex', and if Zenimax supplied it, then it is their bad. Perhaps those of you who work in lua more frequently were easier able to understand what they meant. Personally, it confused me far more than it helped. I'm not sure what Zenimax is up to, but every course I've taken on pre-compiler programming uses the following syntax for library listings: bold is for type italics is for an example variable [] are optional parameters E.x: GetGuildId(uint32 guildIndex) Returns: uint32 guildIndex - 0 if no guild found for index I purposefully avoided stating "valid range from 1-5", because the purpose if this function seems to be to determine whether or not the input is in the valid range. Cheers! |
Quote:
No, you are not misunderstanding, CatoTheElder just has no clue what he is talking about. There is no correlation between the size of a datatype and the memory width size of the architecture. How to do 128bit precision calculation on a 8-bit 8085 cpu was, at least 30 years ago, one of the basic lessons of computer science education. |
Quote:
:rolleyes: Yes and Microsoft is full of morons because their Win32API documentation dares to have a datatype called HWND or HINSTANCE. |
All times are GMT -6. The time now is 06:10 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI