diff options
Diffstat (limited to 'src/lj_carith.c')
-rw-r--r-- | src/lj_carith.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lj_carith.c b/src/lj_carith.c index 8c76abe9..9ffafc2c 100644 --- a/src/lj_carith.c +++ b/src/lj_carith.c | |||
@@ -218,10 +218,18 @@ static int carith_int64(lua_State *L, CTState *cts, CDArith *ca, MMS mm) | |||
218 | static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm) | 218 | static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm) |
219 | { | 219 | { |
220 | cTValue *tv = NULL; | 220 | cTValue *tv = NULL; |
221 | if (tviscdata(L->base)) | 221 | if (tviscdata(L->base)) { |
222 | tv = lj_ctype_meta(cts, cdataV(L->base)->ctypeid, mm); | 222 | CTypeID id = cdataV(L->base)->ctypeid; |
223 | if (!tv && L->base+1 < L->top && tviscdata(L->base+1)) | 223 | CType *ct = ctype_raw(cts, id); |
224 | tv = lj_ctype_meta(cts, cdataV(L->base+1)->ctypeid, mm); | 224 | if (ctype_isptr(ct->info)) id = ctype_cid(ct->info); |
225 | tv = lj_ctype_meta(cts, id, mm); | ||
226 | } | ||
227 | if (!tv && L->base+1 < L->top && tviscdata(L->base+1)) { | ||
228 | CTypeID id = cdataV(L->base+1)->ctypeid; | ||
229 | CType *ct = ctype_raw(cts, id); | ||
230 | if (ctype_isptr(ct->info)) id = ctype_cid(ct->info); | ||
231 | tv = lj_ctype_meta(cts, id, mm); | ||
232 | } | ||
225 | if (!tv) { | 233 | if (!tv) { |
226 | const char *repr[2]; | 234 | const char *repr[2]; |
227 | int i, isenum = -1, isstr = -1; | 235 | int i, isenum = -1, isstr = -1; |