| 61 | } |
| 62 | |
| 63 | static const Proto* combine(lua_State* L, int n) |
| 64 | { |
| 65 | if (n == 1) |
| 66 | return toproto(L, -1); |
| 67 | else |
| 68 | { |
| 69 | Proto* f; |
| 70 | int i = n; |
| 71 | if (lua_load(L, reader, &i, "=(" PROGNAME ")", nullptr) != LUA_OK) |
| 72 | { |
| 73 | // fatal(lua_tostring(L, -1)); |
| 74 | l_fatal(L, lua_tostring(L, -1)); |
| 75 | return nullptr; |
| 76 | } |
| 77 | f = toproto(L, -1); |
| 78 | for (i = 0; i < n; i++) |
| 79 | { |
| 80 | f->p[i] = toproto(L, i - n - 1); |
| 81 | if (f->p[i]->sizeupvalues > 0) f->p[i]->upvalues[0].instack = 0; |
| 82 | } |
| 83 | f->sizelineinfo = 0; |
| 84 | return f; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | static int writer(lua_State* L, const void* p, size_t size, void* u) |
| 89 | { |