Add support for __pairs and __ipairs metamethods (from Lua 5.2).

This commit is contained in:
Mike Pall
2010-11-18 00:23:24 +01:00
parent 3754a8fe7a
commit ba602c9578
9 changed files with 1748 additions and 1685 deletions

View File

@@ -1098,8 +1098,11 @@ static void build_subroutines(BuildCtx *ctx)
| checktab TAB:CARG1
| lwz PC, FRAME_PC(BASE)
| checkfail ->fff_fallback
| lwz TAB:TMP2, TAB:CARG1->metatable
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
| cmplwi TAB:TMP2, 0
| la RA, -8(BASE)
| bne ->fff_fallback
| evstdd TAB:CARG1, 0(BASE)
| evstdd TISNIL, 8(BASE)
| li RD, (3+1)*8
@@ -1150,8 +1153,11 @@ static void build_subroutines(BuildCtx *ctx)
| checktab TAB:CARG1
| lwz PC, FRAME_PC(BASE)
| checkfail ->fff_fallback
| lwz TAB:TMP2, TAB:CARG1->metatable
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
| cmplwi TAB:TMP2, 0
| la RA, -8(BASE)
| bne ->fff_fallback
| evsplati TMP1, 0
| evstdd TAB:CARG1, 0(BASE)
| evstdd TMP1, 8(BASE)