summaryrefslogtreecommitdiff
path: root/src/lj_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_api.c')
-rw-r--r--src/lj_api.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lj_api.c b/src/lj_api.c
index db48e3a6..7a759e5f 100644
--- a/src/lj_api.c
+++ b/src/lj_api.c
@@ -486,8 +486,12 @@ LUA_API size_t lua_objlen(lua_State *L, int idx)
486LUA_API lua_CFunction lua_tocfunction(lua_State *L, int idx) 486LUA_API lua_CFunction lua_tocfunction(lua_State *L, int idx)
487{ 487{
488 cTValue *o = index2adr(L, idx); 488 cTValue *o = index2adr(L, idx);
489 ASMFunction gate = funcV(o)->c.gate; 489 if (tvisfunc(o)) {
490 return (gate == lj_gate_c || gate == lj_gate_cwrap) ? funcV(o)->c.f : NULL; 490 ASMFunction gate = funcV(o)->c.gate;
491 if (gate == lj_gate_c || gate == lj_gate_cwrap)
492 return funcV(o)->c.f;
493 }
494 return NULL;
491} 495}
492 496
493LUA_API void *lua_touserdata(lua_State *L, int idx) 497LUA_API void *lua_touserdata(lua_State *L, int idx)