summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/src/lib/tolua_push.c
diff options
context:
space:
mode:
authorMasy98 <masy@antheruscraft.de>2014-08-30 21:31:51 +0200
committerMasy98 <masy@antheruscraft.de>2014-08-30 21:31:51 +0200
commit2d5a38bd61aa9436f2944f26344b14f92e30f025 (patch)
treed1caaf6446574ffdf676c272e39404ed8184a33b /lib/tolua++/src/lib/tolua_push.c
parentFixed slab name (diff)
parentcChunk: Fixed the Coords param. (diff)
downloadcuberite-2d5a38bd61aa9436f2944f26344b14f92e30f025.tar
cuberite-2d5a38bd61aa9436f2944f26344b14f92e30f025.tar.gz
cuberite-2d5a38bd61aa9436f2944f26344b14f92e30f025.tar.bz2
cuberite-2d5a38bd61aa9436f2944f26344b14f92e30f025.tar.lz
cuberite-2d5a38bd61aa9436f2944f26344b14f92e30f025.tar.xz
cuberite-2d5a38bd61aa9436f2944f26344b14f92e30f025.tar.zst
cuberite-2d5a38bd61aa9436f2944f26344b14f92e30f025.zip
Diffstat (limited to 'lib/tolua++/src/lib/tolua_push.c')
-rw-r--r--lib/tolua++/src/lib/tolua_push.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/tolua++/src/lib/tolua_push.c b/lib/tolua++/src/lib/tolua_push.c
index 947f0e7a5..73a5f6ec0 100644
--- a/lib/tolua++/src/lib/tolua_push.c
+++ b/lib/tolua++/src/lib/tolua_push.c
@@ -16,6 +16,7 @@
#include "../../../lua/src/lauxlib.h"
#include <stdlib.h>
+#include <assert.h>
TOLUA_API void tolua_pushvalue (lua_State* L, int lo)
{
@@ -55,12 +56,14 @@ TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type)
else
{
luaL_getmetatable(L, type);
+ assert(!lua_isnil(L, -1)); /* Failure here means that the usertype is unknown to ToLua. Check what type you're pushing. */
lua_pushstring(L,"tolua_ubox");
lua_rawget(L,-2); /* stack: mt ubox */
- if (lua_isnil(L, -1)) {
- lua_pop(L, 1);
- lua_pushstring(L, "tolua_ubox");
- lua_rawget(L, LUA_REGISTRYINDEX);
+ if (lua_isnil(L, -1))
+ {
+ lua_pop(L, 1);
+ lua_pushstring(L, "tolua_ubox");
+ lua_rawget(L, LUA_REGISTRYINDEX);
};
lua_pushlightuserdata(L,value);
lua_rawget(L,-2); /* stack: mt ubox ubox[u] */