** Convert a valid actual index (not a pseudo-index) to its address. */
| 93 | ** Convert a valid actual index (not a pseudo-index) to its address. |
| 94 | */ |
| 95 | l_sinline StkId index2stack (lua_State *L, int idx) { |
| 96 | CallInfo *ci = L->ci; |
| 97 | if (idx > 0) { |
| 98 | StkId o = ci->func.p + idx; |
| 99 | api_check(L, o < L->top.p, "invalid index"); |
| 100 | return o; |
| 101 | } |
| 102 | else { /* non-positive index */ |
| 103 | api_check(L, idx != 0 && -idx <= L->top.p - (ci->func.p + 1), |
| 104 | "invalid index"); |
| 105 | api_check(L, !ispseudo(idx), "invalid index"); |
| 106 | return L->top.p + idx; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | |
| 111 | LUA_API int lua_checkstack (lua_State *L, int n) { |
no outgoing calls
no test coverage detected