diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-01-11 10:11:47 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-01-11 10:11:47 +0800 |
| commit | 4937e32a628b6950f698f147a121bac6376dd3ba (patch) | |
| tree | 9fb05545062fc72065b9a84f1a68424e1e5b266e /src/moonp.cpp | |
| parent | 843d43f57a52948cf33d126582a01085ffc33421 (diff) | |
| download | yuescript-4937e32a628b6950f698f147a121bac6376dd3ba.tar.gz yuescript-4937e32a628b6950f698f147a121bac6376dd3ba.tar.bz2 yuescript-4937e32a628b6950f698f147a121bac6376dd3ba.zip | |
fix issue #34.
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 | } |
