diff options
author | pixel <pixel> | 2003-12-08 15:12:56 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-12-08 15:12:56 +0000 |
commit | 05bf1ebf8f3a120e4ebb4ac45230222c6717a518 (patch) | |
tree | 8bb2b60d17cc7a5b59467e86740e4a64bf4673cc /lib | |
parent | 4a3352a5fcb01666e91bc21cea2900637caf674c (diff) |
LUA everywhere! Wheee!
Diffstat (limited to 'lib')
-rw-r--r-- | lib/BLua.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index c3f7351..36cc566 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.9 2003-12-07 05:50:41 pixel Exp $ */ +/* $Id: BLua.cc,v 1.10 2003-12-08 15:12:56 pixel Exp $ */ #include <lualib.h>
@@ -321,12 +321,6 @@ bool Lua::isuserdata(int i) { bool Lua::islightuserdata(int i) {
return lua_islightuserdata(L, i);
}
- bool toboolean(int = -1);
- lua_Number tonumber(int = -1);
- String tostring(int = -1);
- lua_CFunction tocfunction(int = -1);
- void * touserdata(int = -1);
- Lua * tothread(int = -1);
bool Lua::toboolean(int i) {
return lua_toboolean(L, i);
@@ -484,15 +478,21 @@ void LuaObject::pushme(Lua * L, void * o) { L->settable();
}
-void * LuaObject::getme(Lua * L, int i) throw (GeneralException) {
+void * LuaObject::getme(Lua * L, int i) {
void * r;
- L->push("__obj");
- L->gettable(i);
- if (!(r = L->touserdata())) {
- throw GeneralException("Lua object already destroyed");
+ if (L->istable(i)) {
+ L->push("__obj");
+ L->gettable(i);
+ if (!(r = L->touserdata())) {
+ L->error("Lua object already destroyed, or table is not an object.");
+ }
+ L->pop();
+ } else if (L->isnil(i)) {
+ r = 0;
+ } else {
+ L->error("Not an object");
}
- L->pop();
return r;
}
@@ -500,7 +500,7 @@ void * LuaObject::getme(Lua * L, int i) throw (GeneralException) { void LuaObject::pushit(Lua * L, const String & s, lua_CFunction f) {
L->push(s);
L->push(f);
- L->settable();
+ L->settable(-3, true);
}
void LuaObject::pushmeta(Lua * L, const String & s, lua_CFunction f) {
|