summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-13 14:38:52 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-13 15:04:08 +1100
commitd8e002a33c6b212891d09a2221edd0f516d13d9a (patch)
tree23b38ad181e2285fd7d467a3d4558ff175946410 /src/lapi.js
parenteb71fa819bf294cb145360ce2d4697200b30bd11 (diff)
downloadfengari-d8e002a33c6b212891d09a2221edd0f516d13d9a.tar.gz
fengari-d8e002a33c6b212891d09a2221edd0f516d13d9a.tar.bz2
fengari-d8e002a33c6b212891d09a2221edd0f516d13d9a.zip
src/lapi.js: Remove emptystring: rely on internal string cache instead
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 9e2f0a3..afa94ce 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -230,13 +230,11 @@ const lua_pushinteger = function(L, n) {
assert(L.top <= L.ci.top, "stack overflow");
};
-const emptystring = defs.to_luastring("");
-
const lua_pushlstring = function(L, s, len) {
assert(typeof len === "number");
let ts;
if (len === 0) {
- s = emptystring;
+ s = defs.to_luastring("", true);
} else {
assert(defs.is_luastring(s) && s.length >= len, "lua_pushlstring expects array of byte");
s = s.slice(0, len);
@@ -525,7 +523,7 @@ const aux_upvalue = function(L, fi, n) {
let f = fi.value;
if (!(1 <= n && n <= f.nupvalues)) return null;
return {
- name: [],
+ name: defs.to_luastring("", true),
val: f.upvalue[n-1]
};
}
@@ -1059,7 +1057,7 @@ const lua_concat = function(L, n) {
if (n >= 2)
lvm.luaV_concat(L, n);
else if (n === 0) {
- lobject.pushsvalue2s(L, lstring.luaS_bless(L, emptystring));
+ lobject.pushsvalue2s(L, lstring.luaS_bless(L, defs.to_luastring("", true)));
assert(L.top <= L.ci.top, "stack overflow");
}
};