From f9375fcb71171d7b18190fa59ec402f7f68e26dd Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 29 Dec 2017 00:47:42 +1100 Subject: src/lauxlib.js: Convert default argument to luaL_optlstring on demand --- src/lauxlib.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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); }; -- cgit v1.2.3-70-g09d2