diff options
Diffstat (limited to 'src/moonp.cpp')
-rw-r--r-- | src/moonp.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/moonp.cpp b/src/moonp.cpp index 30cbe43..27c6016 100644 --- a/src/moonp.cpp +++ b/src/moonp.cpp | |||
@@ -331,7 +331,14 @@ int main(int narg, const char** args) { | |||
331 | lua_pop(L, 1); | 331 | lua_pop(L, 1); |
332 | pushMoonp(L, "pcall"sv); | 332 | pushMoonp(L, "pcall"sv); |
333 | lua_insert(L, -2); | 333 | lua_insert(L, -2); |
334 | if (lua_pcall(L, 1, 2, 0) != 0) { | 334 | int argCount = 0; |
335 | i++; | ||
336 | while (i < narg) { | ||
337 | argCount++; | ||
338 | lua_pushstring(L, args[i]); | ||
339 | i++; | ||
340 | } | ||
341 | if (lua_pcall(L, 1 + argCount, 2, 0) != 0) { | ||
335 | std::cout << lua_tostring(L, -1) << '\n'; | 342 | std::cout << lua_tostring(L, -1) << '\n'; |
336 | return 1; | 343 | return 1; |
337 | } | 344 | } |