summaryrefslogtreecommitdiff
path: root/src/BLua.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/BLua.cc')
-rw-r--r--src/BLua.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/BLua.cc b/src/BLua.cc
index 62e4010..cb0e645 100644
--- a/src/BLua.cc
+++ b/src/BLua.cc
@@ -382,6 +382,8 @@ void Balau::Lua::declareFunc(const char * name, lua_CFunction f, int i) {
checkstack(2);
lua_pushstring(L, name);
lua_pushcfunction(L, f);
+ if ((i < 0) && (i > LUA_REGISTRYINDEX))
+ i += 2;
lua_settable(L, i);
}