diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-09-20 11:57:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-09-20 11:57:29 -0300 |
commit | 04265655a8cda2d3402c339fc388f0b225c142fb (patch) | |
tree | 5439f3216fd9d2738c3343f443d839a0059c1628 /lapi.c | |
parent | e10788b2ff735916bbf6b4ba0e040a4568658ca3 (diff) | |
download | lua-04265655a8cda2d3402c339fc388f0b225c142fb.tar.gz lua-04265655a8cda2d3402c339fc388f0b225c142fb.tar.bz2 lua-04265655a8cda2d3402c339fc388f0b225c142fb.zip |
compatibility with old fallback system now provided by external module
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 27 |
1 files changed, 2 insertions, 25 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.47 1999/06/22 20:37:23 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.48 1999/08/16 20:52:00 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -85,7 +85,7 @@ static lua_Object put_luaObject (const TObject *o) { | |||
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | static lua_Object put_luaObjectonTop (void) { | 88 | lua_Object put_luaObjectonTop (void) { |
89 | luaD_openstack((L->stack.top-L->stack.stack)-L->Cstack.base); | 89 | luaD_openstack((L->stack.top-L->stack.stack)-L->Cstack.base); |
90 | L->stack.stack[L->Cstack.base++] = *(--L->stack.top); | 90 | L->stack.stack[L->Cstack.base++] = *(--L->stack.top); |
91 | return L->Cstack.base; /* this is +1 real position (see Ref) */ | 91 | return L->Cstack.base; /* this is +1 real position (see Ref) */ |
@@ -629,26 +629,3 @@ lua_Object lua_getref (int ref) { | |||
629 | 629 | ||
630 | /* }====================================================== */ | 630 | /* }====================================================== */ |
631 | 631 | ||
632 | |||
633 | |||
634 | #ifdef LUA_COMPAT2_5 | ||
635 | /* | ||
636 | ** API: set a function as a fallback | ||
637 | */ | ||
638 | |||
639 | static void do_unprotectedrun (lua_CFunction f, int nParams, int nResults) { | ||
640 | luaD_openstack(nParams); | ||
641 | (L->stack.top-nParams)->ttype = LUA_T_CPROTO; | ||
642 | (L->stack.top-nParams)->value.f = f; | ||
643 | luaD_calln(nParams, nResults); | ||
644 | } | ||
645 | |||
646 | |||
647 | lua_Object lua_setfallback (char *name, lua_CFunction fallback) { | ||
648 | lua_pushstring(name); | ||
649 | lua_pushcfunction(fallback); | ||
650 | do_unprotectedrun(luaT_setfallback, 2, 1); | ||
651 | return put_luaObjectonTop(); | ||
652 | } | ||
653 | #endif | ||
654 | |||