** Dump a Lua function, calling 'writer' to write its parts. Ensure ** the stack returns with its original size. */
| 1146 | ** the stack returns with its original size. |
| 1147 | */ |
| 1148 | LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { |
| 1149 | int status; |
| 1150 | ptrdiff_t otop = savestack(L, L->top.p); /* original top */ |
| 1151 | TValue *f = s2v(L->top.p - 1); /* function to be dumped */ |
| 1152 | lua_lock(L); |
| 1153 | api_checkpop(L, 1); |
| 1154 | api_check(L, isLfunction(f), "Lua function expected"); |
| 1155 | status = luaU_dump(L, clLvalue(f)->p, writer, data, strip); |
| 1156 | L->top.p = restorestack(L, otop); /* restore top */ |
| 1157 | lua_unlock(L); |
| 1158 | return status; |
| 1159 | } |
| 1160 | |
| 1161 | |
| 1162 | LUA_API int lua_status (lua_State *L) { |