summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/defs.js4
1 files changed, 3 insertions, 1 deletions
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;
};