summaryrefslogtreecommitdiff
path: root/lib/BLua.cc
diff options
context:
space:
mode:
authorpixel <pixel>2004-12-17 11:46:41 +0000
committerpixel <pixel>2004-12-17 11:46:41 +0000
commitf5b39b3e6da6ddf8e5eef4fa1d6e7548856f37eb (patch)
treea53e67cb1444c9311d7eb82e410f66c08014cdf8 /lib/BLua.cc
parentd6c1d1aee64aae2006892e87c4f98cf2325dc301 (diff)
Added lua's isobject method.
Diffstat (limited to 'lib/BLua.cc')
-rw-r--r--lib/BLua.cc15
1 files changed, 14 insertions, 1 deletions
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);
}