[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How does lua_touserdata work? Userdata also..
- From: "phantom2023" <phantom2023@...>
- Date: Thu, 27 Mar 2003 22:15:06 -0000
I have a function:
int l_Poke(lua_State* luaVM)
{
char *address1 = NULL;
DWORD address = 0;
void *value = 0;
int size = 0;
address1 = (char *)lua_tostring(luaVM, 1);
value = (void *)lua_touserdata(luaVM, 2);
size = (int)lua_tonumber(luaVM, 3);
if (value == NULL)
MessageBox(NULL, "Uh oh", NULL, MB_OK);
address = hextoint(address1);
theScriptWindow->Poke(address, value, size);
return 1;
}
called like:
Poke("0100579C", 5, 4)
in the script ( 5 being the value here)
It's supposed to be a void * because I want to cast it to BYTE,
WORD, or DWORD depending on the size parameter.
However.. value always comes out NULL.
What am I doing wrong?