Thread: luaindex type
View Single Post
05/12/14, 05:19 AM   #13
CatoTheElder
Join Date: May 2014
Posts: 44
Originally Posted by Harven View Post
Hey, and why is that? Nothing is stopping you from using 64bit variables in 32bit machine/system/application. Here is some simple C application example:
Code:
#include <stdio.h>
#include <stdlib.h>

int main( int argc, char *argv[] )
{
        unsigned long long integer64bit = 0xffffffffffffffff;
        printf( "%d %llu\n", sizeof(long long), integer64bit );
        return EXIT_SUCCESS;
}
I'm runing it on my 32bit ARMv7 machine, and the output is:
Code:
[harven@fedora-arm test]$ ./bittest
8 18446744073709551615
And in the game on my 64bit Windows 7:
Lua Code:
  1. /script local var = 18446744073709551615 d(var.." type: "..type(var).." "..string.format("%l", var))
gives this:
Code:
1.844674407371e+019 type: number
Luaindex is not a type, it's a clue so we know what numbers we can use. It's like
Code:
typedef double luaindex
you can still pass -1, 3.2 and so one, but the name tells you what the function expects.
Hahahaha, Fedora on ARM, curious. Big tip of the hat for running that combo!

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!
  Reply With Quote