aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 4bd8664..3a2ea39 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -668,7 +668,7 @@ const str_rep = function(L) {
let n = lauxlib.luaL_checkinteger(L, 2);
let sep = lauxlib.luaL_optstring(L, 3, "");
- lapi.lua_pushstring(L, (s + sep).repeat(n - 1) + s);
+ lapi.lua_pushstring(L, n > 0 ? (s + sep).repeat(n - 1) + s : "");
return 1;
};