functions "lua_is..." consider coercions.
small change when calling call hook.
This commit is contained in:
30
opcode.c
30
opcode.c
@@ -3,7 +3,7 @@
|
|||||||
** TecCGraf - PUC-Rio
|
** TecCGraf - PUC-Rio
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *rcs_opcode="$Id: opcode.c,v 3.60 1996/03/15 13:13:13 roberto Exp roberto $";
|
char *rcs_opcode="$Id: opcode.c,v 3.61 1996/03/19 16:50:24 roberto Exp roberto $";
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -259,13 +259,10 @@ static StkId callC (lua_CFunction func, StkId base)
|
|||||||
/* incorporate parameters on the stack */
|
/* incorporate parameters on the stack */
|
||||||
CBase = base+CnResults; /* == top-stack */
|
CBase = base+CnResults; /* == top-stack */
|
||||||
if (call_hook)
|
if (call_hook)
|
||||||
{
|
callHook(base, LUA_T_CMARK, 0);
|
||||||
callHook (base, LUA_T_CMARK, 0);
|
(*func)();
|
||||||
(*func)();
|
if (call_hook) /* func may have changed call_hook */
|
||||||
callHook (base, LUA_T_CMARK, 1);
|
callHook(base, LUA_T_CMARK, 1);
|
||||||
}
|
|
||||||
else
|
|
||||||
(*func)();
|
|
||||||
firstResult = CBase;
|
firstResult = CBase;
|
||||||
CBase = oldBase;
|
CBase = oldBase;
|
||||||
CnResults = oldCnResults;
|
CnResults = oldCnResults;
|
||||||
@@ -673,6 +670,23 @@ lua_Object lua_getparam (int number)
|
|||||||
return CBase-CnResults+number;
|
return CBase-CnResults+number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lua_isnumber (lua_Object object)
|
||||||
|
{
|
||||||
|
return (object != LUA_NOOBJECT) && (tonumber(Address(object)) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_isstring (lua_Object object)
|
||||||
|
{
|
||||||
|
int t = lua_type(object);
|
||||||
|
return (t == LUA_T_STRING) || (t == LUA_T_NUMBER);
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_isfunction (lua_Object object)
|
||||||
|
{
|
||||||
|
int t = lua_type(object);
|
||||||
|
return (t == LUA_T_FUNCTION) || (t == LUA_T_CFUNCTION);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Given an object handle, return its number value. On error, return 0.0.
|
** Given an object handle, return its number value. On error, return 0.0.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user