summaryrefslogtreecommitdiff
path: root/include/BLua.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/BLua.h')
-rw-r--r--include/BLua.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/include/BLua.h b/include/BLua.h
index 8e4f549..a0d33c1 100644
--- a/include/BLua.h
+++ b/include/BLua.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: BLua.h,v 1.7 2003-12-07 04:44:38 pixel Exp $ */
+/* $Id: BLua.h,v 1.8 2003-12-08 15:12:56 pixel Exp $ */
#ifndef __BLUA_H__
#define __BLUA_H__
@@ -88,7 +88,7 @@ class LuaObject : public Base {
public:
LuaObject() : wantdestruct(false), pushed(false) {}
virtual void push(Lua *) throw (GeneralException);
- static void * getme(Lua *, int = 1) throw (GeneralException);
+ static void * getme(Lua *, int = 1);
void pushdestruct(Lua *) throw (GeneralException);
protected:
virtual void pushmembers(Lua *) = 0;
@@ -177,7 +177,8 @@ class LuaHelpers : public Base {
public:
static int method_multiplex(int caller, lua_State * _L, int (*proceed)(Lua * L, int n, T * obj, int caller), int (*proceed_static)(Lua * L, int n, int caller), lua_functypes_t * tab, bool method) {
Lua * L = Lua::find(_L);
- int n = L->gettop() - (method ? 1 : 0);
+ int add = method ? 1 : 0;
+ int n = L->gettop() - add;
T * obj = (T *) LuaObject::getme(L);
int i;
bool invalid = false;
@@ -191,28 +192,29 @@ class LuaHelpers : public Base {
case LUA_ANY:
break;
case LUA_OBJECT:
- invalid = !L->istable(i + 2);
- if (!invalid) {
+ if (L->istable(i + 1 + add)) {
L->push("__obj");
- L->gettable(i + 2);
- invalid = L->islightuserdata();
+ L->gettable(i + 1 + add);
+ invalid = !L->islightuserdata();
L->pop();
+ } else {
+ invalid = !L->isnil(i + 1 + add);
}
break;
case LUA_TABLE:
- invalid = !L->istable(i + 2);
+ invalid = !L->istable(i + 1 + add);
break;
case LUA_BOOLEAN:
- invalid = !L->isboolean(i + 2);
+ invalid = !L->isboolean(i + 1 + add);
break;
case LUA_NUMBER:
- invalid = !L->isnumber(i + 2);
+ invalid = !L->isnumber(i + 1 + add);
break;
case LUA_STRING:
- invalid = !L->isstring(i + 2);
+ invalid = !L->isstring(i + 1 + add);
break;
case LUA_FUNCTION:
- invalid = !L->isfunction(i + 2);
+ invalid = !L->isfunction(i + 1 + add);
break;
}
}
@@ -236,9 +238,9 @@ class LuaHelpers : public Base {
};
-/*********************************\
+ /*******************************\
|** Let's have a sample of use **|
-\*********************************/
+ \*******************************/
#ifdef THIS_IS_A_SAMPLE_WHICH_DOES_NOT_COMPILE
Luacdfile::Luacdfile(cdfile * h) : LuaHandle(h) { }