From 83de14b90b5f5c80a168d317cf41884aa20a24a0 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 15 Dec 2017 16:25:27 +1100 Subject: src/defs.js: Automatically convert js strings --- src/defs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/defs.js b/src/defs.js index a2c5c75..c231c3d 100644 --- a/src/defs.js +++ b/src/defs.js @@ -248,7 +248,9 @@ const to_luastring = function(str, cache) { }; const from_userstring = function(str) { - assert(is_luastring(str), "expects an array of bytes"); + if (typeof str === "string") + return to_luastring(str); + assert(is_luastring(str), "expects an array of bytes or javascript string"); return str; }; -- cgit v1.2.3-54-g00ecf