summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-04-22 23:29:34 +1000
committerdaurnimator <quae@daurnimator.com>2018-04-23 00:00:13 +1000
commit3e31a33728f0eba63184c6cb0678fe3af3e8e08e (patch)
treedadc12fd39775959b91ac9451643a3ed19a4ac09
parent84194191c49e9aa2375633061343960f71d7555e (diff)
downloadfengari-3e31a33728f0eba63184c6cb0678fe3af3e8e08e.tar.gz
fengari-3e31a33728f0eba63184c6cb0678fe3af3e8e08e.tar.bz2
fengari-3e31a33728f0eba63184c6cb0678fe3af3e8e08e.zip
src/lauxlib.js: Use from_userstring in luaL_add(l)string
-rw-r--r--NEWS1
-rw-r--r--src/lauxlib.js2
2 files changed, 3 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 2e13a83..74fddf3 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ UNRELEASED
- More node 6 compatibility fixes
- Use own strftime code (drops strftime npm package dependency)
+ - Fix passing JavaScript strings to luaL_add(l)string
0.1.1 - 2018-04-03
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 2276bd0..9d414b2 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -482,6 +482,7 @@ const luaL_prepbuffer = function(B) {
const luaL_addlstring = function(B, s, l) {
if (l > 0) {
+ s = from_userstring(s);
let b = luaL_prepbuffsize(B, l);
b.set(s.subarray(0, l));
luaL_addsize(B, l);
@@ -489,6 +490,7 @@ const luaL_addlstring = function(B, s, l) {
};
const luaL_addstring = function(B, s) {
+ s = from_userstring(s);
luaL_addlstring(B, s, s.length);
};