Original Post
Hello everyone! Okay, I've used toLua to write a Lua wrapper for my 'Image' class. I've written a function to retrieve the (Lua) global 'BottomLayer' of type Image, here it is: It returns a non-null pointer, so far so good, but the Image's width is 13000-something when it should be 800. Everything works okay in Lua, the width is 800 and everything seems to work. It's somethig with lua_touserdata(...) it seems. Or maybe not? Can anyone aid me? Thanks in advance!
Image *Map::GetBottomLayer()
{
lua_getglobal(Script, "BottomLayer");
return (Image*)(lua_touserdata(Script, 1));
}