aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lauxlib.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index b4d839d..8cb608d 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -325,6 +325,8 @@ const luaL_checkstring = luaL_checklstring;
const luaL_optlstring = function(L, arg, def) {
if (lua.lua_type(L, arg) <= 0) {
+ if (typeof str === "string")
+ def = lua.to_luastring(def);
return def;
} else return luaL_checklstring(L, arg);
};