summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/BLua.h3
-rw-r--r--lib/BLua.cc15
2 files changed, 16 insertions, 2 deletions
diff --git a/include/BLua.h b/include/BLua.h
index 4e350aa..d5e4f2b 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.21 2004-12-12 02:10:09 pixel Exp $ */
+/* $Id: BLua.h,v 1.22 2004-12-17 11:46:41 pixel Exp $ */
#ifndef __BLUA_H__
#define __BLUA_H__
@@ -81,6 +81,7 @@ class Lua : public Base {
bool iscfunction(int = -1);
bool isuserdata(int = -1);
bool islightuserdata(int = -1);
+ bool isobject(int = -1);
bool toboolean(int = -1);
lua_Number tonumber(int = -1);
String tostring(int = -1);
diff --git a/lib/BLua.cc b/lib/BLua.cc
index 60cf4f2..5e046fd 100644
--- a/lib/BLua.cc
+++ b/lib/BLua.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: BLua.cc,v 1.23 2004-12-13 20:07:09 pixel Exp $ */
+/* $Id: BLua.cc,v 1.24 2004-12-17 11:46:41 pixel Exp $ */
#include "BLua.h"
#include <lualib.h>
@@ -416,6 +416,19 @@ bool Lua::islightuserdata(int i) {
return lua_islightuserdata(L, i);
}
+bool Lua::isobject(int i) {
+ bool r = false;
+ if (istable(i)) {
+ push("__obj");
+ gettable(i);
+ r = isuserdata();
+ pop();
+ } else {
+ r = isnil(i);
+ }
+ return r;
+}
+
bool Lua::toboolean(int i) {
return lua_toboolean(L, i);
}