lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


[...]
>    address1 = (char *)lua_tostring(luaVM, 1);
>    value = (void *)lua_touserdata(luaVM, 2);
>    size = (int)lua_tonumber(luaVM, 3);
[...]
> called like:
> Poke("0100579C", 5, 4)
[...]
> What am I doing wrong?

You can't ask Lua to convert a number to userdata, and that's what the
second parameter is. I don't understand what you're really trying to do,
but if you want to access a raw number as a void* (what seems really
weird in this context), just cast it *after* converting to a lua number
(e.g. "(void*)lua_tonumber(L, 2)").

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]