How to use double LSType??
Moderators: Lavish Software Team, Moderators
-
- GamingTools Subscriber
- Posts: 74
- Joined: Sun Jun 25, 2006 8:29 am
How to use double LSType??
addLStype?? don't know how to use it.
PLSTYPEMEMBER pMember,I need a double member.
thanks
PLSTYPEMEMBER pMember,I need a double member.
thanks
Re: How to use double LSType??
ISInterface:AddLSType? Or are you looking at Command:LSType?blackwinter wrote:addLStype?? don't know how to use it.
PLSTYPEMEMBER pMember,I need a double member.
thanks
Help us out here and tell us what you are trying to do....
-j
-
- GamingTools Subscriber
- Posts: 74
- Joined: Sun Jun 25, 2006 8:29 am
Okay, this makes much more sense.
The way LavishScript objects work is by storing a 32-bit value, and a pointer to a type interface (aka how to read the value). Anything that can be stored in 32-bits can be kept right there in the LSOBJECT, and it'd effectively be a "value type". Anything larger MUST be stored by reference, i.e. a "reference type".
The 64-bit floating point type in LS is "float64ptr". You either want to allocate memory with GetTempBuffer, or use a pointer to the original value if it's a value that will not be disappearing. If you dont know, use GetTempBuffer.
Here's a quick code sample.
The way LavishScript objects work is by storing a 32-bit value, and a pointer to a type interface (aka how to read the value). Anything that can be stored in 32-bits can be kept right there in the LSOBJECT, and it'd effectively be a "value type". Anything larger MUST be stored by reference, i.e. a "reference type".
The 64-bit floating point type in LS is "float64ptr". You either want to allocate memory with GetTempBuffer, or use a pointer to the original value if it's a value that will not be disappearing. If you dont know, use GetTempBuffer.
Here's a quick code sample.
Code: Select all
LSOBJECT dest; // object being returned...
double myDouble = 12.345f; // value to use ...
Dest.Ptr = pISInterface->GetTempBuffer(sizeof(myDouble),&myDouble); // allocate enough memory to store a copy of myDouble, and copy it
Dest.Type = pFloat64PtrType;
-
- GamingTools Subscriber
- Posts: 74
- Joined: Sun Jun 25, 2006 8:29 am
Code: Select all
unsigned int memory_address = ((unsigned int)GetModuleHandle("game.exe"))+842740; // calculate actual memory address
double *pTheirDouble = (double*)memory_address; // point to a double at that memory address
myDouble = *pTheirDouble; // copy the double at the memory address to our local variable
-
- GamingTools Subscriber
- Posts: 74
- Joined: Sun Jun 25, 2006 8:29 am