summaryrefslogtreecommitdiffstats
path: root/lib/tolua++
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tolua++')
-rw-r--r--lib/tolua++/include/tolua++.h4
-rw-r--r--lib/tolua++/src/bin/lua/_driver.lua3
-rw-r--r--lib/tolua++/src/lib/tolua_push.c11
3 files changed, 13 insertions, 5 deletions
diff --git a/lib/tolua++/include/tolua++.h b/lib/tolua++/include/tolua++.h
index 8da427fe3..c8b654ae6 100644
--- a/lib/tolua++/include/tolua++.h
+++ b/lib/tolua++/include/tolua++.h
@@ -36,7 +36,9 @@ extern "C" {
#define TEMPLATE_BIND(p)
#endif
-#define TOLUA_TEMPLATE_BIND(p)
+#ifndef TOLUA_TEMPLATE_BIND
+ #define TOLUA_TEMPLATE_BIND(p)
+#endif
#define TOLUA_PROTECTED_DESTRUCTOR
#define TOLUA_PROPERTY_TYPE(p)
diff --git a/lib/tolua++/src/bin/lua/_driver.lua b/lib/tolua++/src/bin/lua/_driver.lua
index 87ecd42ea..1ca18862b 100644
--- a/lib/tolua++/src/bin/lua/_driver.lua
+++ b/lib/tolua++/src/bin/lua/_driver.lua
@@ -3,6 +3,9 @@
local mobdebugfound, mobdebug = pcall(require, "mobdebug")
if mobdebugfound then mobdebug.start() end
+-- Disable buffering for stdout, so that the results appear immediately:
+io.output():setvbuf("no")
+
-- The list of valid arguments that the ToLua scripts can process:
local KnownArgs = {
['v'] = true,
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] */