summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/BLua.cc28
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) {