diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:03:04 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-06-19 15:03:04 -0300 |
commit | 88f020b626d1b5b10b5d12e04bf103409a5e4308 (patch) | |
tree | e8d65e90ce914acebbd74c528b660db21ef27084 /opcode.c | |
parent | a38f093f0540bce0207bb2dc27f1779f41c6d48b (diff) | |
download | lua-88f020b626d1b5b10b5d12e04bf103409a5e4308.tar.gz lua-88f020b626d1b5b10b5d12e04bf103409a5e4308.tar.bz2 lua-88f020b626d1b5b10b5d12e04bf103409a5e4308.zip |
new interface to "lua_seterrormethod" and "lua_settagmethod", to
allow the use of Lua functions too.
Diffstat (limited to 'opcode.c')
-rw-r--r-- | opcode.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_opcode="$Id: opcode.c,v 4.11 1997/06/16 19:48:18 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 4.12 1997/06/19 17:46:12 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
@@ -654,21 +654,21 @@ lua_Object lua_gettagmethod (int tag, char *event) | |||
654 | return put_luaObjectonTop(); | 654 | return put_luaObjectonTop(); |
655 | } | 655 | } |
656 | 656 | ||
657 | lua_Object lua_settagmethod (int tag, char *event, lua_CFunction method) | 657 | lua_Object lua_settagmethod (int tag, char *event) |
658 | { | 658 | { |
659 | TObject newmethod; | ||
660 | checkCparams(1); | ||
661 | newmethod = *(--top); | ||
659 | lua_pushnumber(tag); | 662 | lua_pushnumber(tag); |
660 | lua_pushstring(event); | 663 | lua_pushstring(event); |
661 | if (method) | 664 | *top = newmethod; incr_top; |
662 | lua_pushcfunction (method); | ||
663 | else | ||
664 | lua_pushnil(); | ||
665 | do_unprotectedrun(luaI_settagmethod, 3, 1); | 665 | do_unprotectedrun(luaI_settagmethod, 3, 1); |
666 | return put_luaObjectonTop(); | 666 | return put_luaObjectonTop(); |
667 | } | 667 | } |
668 | 668 | ||
669 | lua_Object lua_seterrormethod (lua_CFunction method) | 669 | lua_Object lua_seterrormethod (void) |
670 | { | 670 | { |
671 | lua_pushcfunction(method); | 671 | checkCparams(1); |
672 | do_unprotectedrun(luaI_seterrormethod, 1, 1); | 672 | do_unprotectedrun(luaI_seterrormethod, 1, 1); |
673 | return put_luaObjectonTop(); | 673 | return put_luaObjectonTop(); |
674 | } | 674 | } |