summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-29 00:47:42 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-29 02:32:41 +1100
commitf9375fcb71171d7b18190fa59ec402f7f68e26dd (patch)
tree8ebbed2fb6a89ec5a91450e959645f7625115a15
parenteb214f05b57f2fe0e980d54a0573167b20c218d8 (diff)
downloadfengari-f9375fcb71171d7b18190fa59ec402f7f68e26dd.tar.gz
fengari-f9375fcb71171d7b18190fa59ec402f7f68e26dd.tar.bz2
fengari-f9375fcb71171d7b18190fa59ec402f7f68e26dd.zip
src/lauxlib.js: Convert default argument to luaL_optlstring on demand
-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);
};