diff options
Diffstat (limited to 'src/lj_api.c')
-rw-r--r-- | src/lj_api.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_api.c b/src/lj_api.c index ad28bbf2..a19f0b33 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "lj_udata.h" | 18 | #include "lj_udata.h" |
19 | #include "lj_meta.h" | 19 | #include "lj_meta.h" |
20 | #include "lj_state.h" | 20 | #include "lj_state.h" |
21 | #include "lj_bc.h" | ||
21 | #include "lj_frame.h" | 22 | #include "lj_frame.h" |
22 | #include "lj_trace.h" | 23 | #include "lj_trace.h" |
23 | #include "lj_vm.h" | 24 | #include "lj_vm.h" |
@@ -487,8 +488,8 @@ LUA_API lua_CFunction lua_tocfunction(lua_State *L, int idx) | |||
487 | { | 488 | { |
488 | cTValue *o = index2adr(L, idx); | 489 | cTValue *o = index2adr(L, idx); |
489 | if (tvisfunc(o)) { | 490 | if (tvisfunc(o)) { |
490 | ASMFunction gate = funcV(o)->c.gate; | 491 | BCOp op = bc_op(*mref(funcV(o)->c.pc, BCIns)); |
491 | if (gate == lj_gate_c || gate == lj_gate_cwrap) | 492 | if (op == BC_FUNCC || op == BC_FUNCCW) |
492 | return funcV(o)->c.f; | 493 | return funcV(o)->c.f; |
493 | } | 494 | } |
494 | return NULL; | 495 | return NULL; |