aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-15 16:25:27 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-29 02:32:41 +1100
commit83de14b90b5f5c80a168d317cf41884aa20a24a0 (patch)
tree2684549c0d932fddc2c7da562f117d5868d85be4 /src
parentffbae7dce27aff68a0f37529e1837378efa43a36 (diff)
downloadfengari-83de14b90b5f5c80a168d317cf41884aa20a24a0.tar.gz
fengari-83de14b90b5f5c80a168d317cf41884aa20a24a0.tar.bz2
fengari-83de14b90b5f5c80a168d317cf41884aa20a24a0.zip
src/defs.js: Automatically convert js strings
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;
};