/* ** fallback.c ** TecCGraf - PUC-Rio */ char *rcs_fallback="$Id: fallback.c,v 1.8 1994/11/21 13:30:15 roberto Exp roberto $"; #include #include "mem.h" #include "fallback.h" #include "opcode.h" #include "inout.h" #include "lua.h" static void errorFB (void); static void indexFB (void); static void gettableFB (void); static void arithFB (void); static void concatFB (void); static void orderFB (void); static void GDFB (void); static void funcFB (void); /* ** Warning: This list must be in the same order as the #define's */ struct FB luaI_fallBacks[] = { {"error", {LUA_T_CFUNCTION, errorFB}}, {"index", {LUA_T_CFUNCTION, indexFB}}, {"gettable", {LUA_T_CFUNCTION, gettableFB}}, {"arith", {LUA_T_CFUNCTION, arithFB}}, {"order", {LUA_T_CFUNCTION, orderFB}}, {"concat", {LUA_T_CFUNCTION, concatFB}}, {"settable", {LUA_T_CFUNCTION, gettableFB}}, {"gc", {LUA_T_CFUNCTION, GDFB}}, {"function", {LUA_T_CFUNCTION, funcFB}} }; #define N_FB (sizeof(luaI_fallBacks)/sizeof(struct FB)) void luaI_setfallback (void) { int i; char *name = lua_getstring(lua_getparam(1)); lua_Object func = lua_getparam(2); if (name == NULL || !(lua_isfunction(func) || lua_iscfunction(func))) { lua_pushnil(); return; } for (i=0; i