summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-29 00:48:15 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-29 02:32:41 +1100
commitc93673f0af0ebdc5165cf0acc340f65b6c6fa786 (patch)
tree9da0e536d0cb10e25fc4fe8df4705f87326136af
parentf9375fcb71171d7b18190fa59ec402f7f68e26dd (diff)
downloadfengari-c93673f0af0ebdc5165cf0acc340f65b6c6fa786.tar.gz
fengari-c93673f0af0ebdc5165cf0acc340f65b6c6fa786.tar.bz2
fengari-c93673f0af0ebdc5165cf0acc340f65b6c6fa786.zip
src/: Pass js string to luaL_opt(l)string
-rw-r--r--src/lbaselib.js6
-rw-r--r--src/ldblib.js2
-rw-r--r--src/loadlib.js4
-rw-r--r--src/loslib.js2
-rw-r--r--src/lstrlib.js2
-rw-r--r--src/ltablib.js2
6 files changed, 9 insertions, 9 deletions
diff --git a/src/lbaselib.js b/src/lbaselib.js
index 86ba6cc..d000ae4 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -108,7 +108,7 @@ const opts = [
"isrunning"
].map((e) => lua.to_luastring(e));
const luaB_collectgarbage = function(L) {
- lauxlib.luaL_checkoption(L, 1, lua.to_luastring("collect"), opts);
+ lauxlib.luaL_checkoption(L, 1, "collect", opts);
lauxlib.luaL_optinteger(L, 2, 0);
lauxlib.luaL_error(L, lua.to_luastring("lua_gc not implemented"));
};
@@ -341,14 +341,14 @@ const generic_reader = function(L, ud) {
const luaB_load = function(L) {
let s = lua.lua_tostring(L, 1);
- let mode = lauxlib.luaL_optstring(L, 3, lua.to_luastring("bt", true));
+ let mode = lauxlib.luaL_optstring(L, 3, "bt");
let env = !lua.lua_isnone(L, 4) ? 4 : 0; /* 'env' index or 0 if no 'env' */
let status;
if (s !== null) { /* loading a string? */
let chunkname = lauxlib.luaL_optstring(L, 2, s);
status = lauxlib.luaL_loadbufferx(L, s, s.length, chunkname, mode);
} else { /* loading from a reader function */
- let chunkname = lauxlib.luaL_optstring(L, 2, lua.to_luastring("=(load)", true));
+ let chunkname = lauxlib.luaL_optstring(L, 2, "=(load)");
lauxlib.luaL_checktype(L, 1, lua.LUA_TFUNCTION);
lua.lua_settop(L, RESERVEDSLOT); /* create reserved slot */
status = lua.lua_load(L, generic_reader, null, chunkname, mode);
diff --git a/src/ldblib.js b/src/ldblib.js
index e687ec1..eb64b03 100644
--- a/src/ldblib.js
+++ b/src/ldblib.js
@@ -120,7 +120,7 @@ const db_getinfo = function(L) {
let thread = getthread(L);
let arg = thread.arg;
let L1 = thread.thread;
- let options = lauxlib.luaL_optstring(L, arg + 2, lua.to_luastring("flnStu", true));
+ let options = lauxlib.luaL_optstring(L, arg + 2, "flnStu");
checkstack(L, L1, 3);
if (lua.lua_isfunction(L, arg + 1)) { /* info about a function? */
options = lua.lua_pushfstring(L, lua.to_luastring(">%s"), options); /* add '>' to 'options' */
diff --git a/src/loadlib.js b/src/loadlib.js
index 0be1742..53d764b 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -294,8 +294,8 @@ const ll_searchpath = function(L) {
L,
lauxlib.luaL_checkstring(L, 1),
lauxlib.luaL_checkstring(L, 2),
- lauxlib.luaL_optstring(L, 3, lua.to_luastring(".")),
- lauxlib.luaL_optstring(L, 4, lua.to_luastring(lua.LUA_DIRSEP))
+ lauxlib.luaL_optstring(L, 3, "."),
+ lauxlib.luaL_optstring(L, 4, lua.LUA_DIRSEP)
);
if (f !== null) return 1;
else { /* error message is on top of the stack */
diff --git a/src/loslib.js b/src/loslib.js
index ecd42f1..99e5787 100644
--- a/src/loslib.js
+++ b/src/loslib.js
@@ -86,7 +86,7 @@ const checkoption = function(L, conv, i, buff) {
const os_date = function(L) {
- let s = lauxlib.luaL_optlstring(L, 1, lua.to_luastring("%c"));
+ let s = lauxlib.luaL_optlstring(L, 1, "%c");
let t = lauxlib.luaL_opt(L, l_checktime, 2, new Date().getTime() / 1000) * 1000;
let stm = new Date(t);
let utc = false;
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 362942d..a8a017f 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -617,7 +617,7 @@ const str_rep = function(L) {
let s = lauxlib.luaL_checkstring(L, 1);
let l = s.length;
let n = lauxlib.luaL_checkinteger(L, 2);
- let sep = lauxlib.luaL_optstring(L, 3, lua.to_luastring(""));
+ let sep = lauxlib.luaL_optstring(L, 3, "");
let lsep = sep.length;
if (n <= 0) lua.lua_pushliteral(L, "");
else if (l + lsep < l || l + lsep > MAXSIZE / n) /* may overflow? */
diff --git a/src/ltablib.js b/src/ltablib.js
index 70ff595..56671c4 100644
--- a/src/ltablib.js
+++ b/src/ltablib.js
@@ -130,7 +130,7 @@ const tmove = function(L) {
const tconcat = function(L) {
let last = aux_getn(L, 1, TAB_R);
- let sep = lauxlib.luaL_optlstring(L, 2, lua.to_luastring(""));
+ let sep = lauxlib.luaL_optlstring(L, 2, "");
let i = lauxlib.luaL_optinteger(L, 3, 1);
last = lauxlib.luaL_optinteger(L, 4, last);