aboutsummaryrefslogtreecommitdiff
path: root/opcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'opcode.c')
-rw-r--r--opcode.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/opcode.c b/opcode.c
index cde3dcdc..be2be6a3 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 3.89 1997/03/31 20:59:09 roberto Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 3.90 1997/04/01 19:02:43 roberto Exp roberto $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -332,7 +332,7 @@ static void pushsubscript (void)
332 } 332 }
333 } 333 }
334 else { /* object is not a table, and/or has a specific "gettable" method */ 334 else { /* object is not a table, and/or has a specific "gettable" method */
335 if (im) 335 if (ttype(im) != LUA_T_NIL)
336 callIM(im, 2, 1); 336 callIM(im, 2, 1);
337 else 337 else
338 lua_error("indexed expression not a table"); 338 lua_error("indexed expression not a table");
@@ -821,10 +821,18 @@ char *lua_getstring (lua_Object object)
821void *lua_getbinarydata (lua_Object object) 821void *lua_getbinarydata (lua_Object object)
822{ 822{
823 if (object == LUA_NOOBJECT || ttype(Address(object)) != LUA_T_USERDATA) 823 if (object == LUA_NOOBJECT || ttype(Address(object)) != LUA_T_USERDATA)
824 lua_error("getbinarydata: object is not binary data"); 824 return NULL;
825 return svalue(Address(object)); 825 else return svalue(Address(object));
826} 826}
827 827
828void *lua_getuserdata (lua_Object object)
829{
830 void *add = lua_getbinarydata(object);
831 if (add == NULL) return NULL;
832 else return *(void **)add;
833}
834
835
828int lua_getbindatasize (lua_Object object) 836int lua_getbindatasize (lua_Object object)
829{ 837{
830 if (object == LUA_NOOBJECT || ttype(Address(object)) != LUA_T_USERDATA) 838 if (object == LUA_NOOBJECT || ttype(Address(object)) != LUA_T_USERDATA)