aboutsummaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-02 02:35:06 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-02 02:35:06 +1100
commit2de7580fb1109c5342de0088c174eec634594c00 (patch)
tree0f40ab7d3b28e1b7a41badbcf7ae4b564b812300 /src/lauxlib.js
parentc8d6c4323c62c38a4fad40642cd9db166caa910a (diff)
downloadfengari-2de7580fb1109c5342de0088c174eec634594c00.tar.gz
fengari-2de7580fb1109c5342de0088c174eec634594c00.tar.bz2
fengari-2de7580fb1109c5342de0088c174eec634594c00.zip
Export strings from lauxlib in lua string form (rather than as javascript string)
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 518190f..d976cee 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -3,12 +3,12 @@
const lua = require('./lua.js');
/* key, in the registry, for table of loaded modules */
-const LUA_LOADED_TABLE = "_LOADED";
+const LUA_LOADED_TABLE = lua.to_luastring("_LOADED");
/* key, in the registry, for table of preloaded loaders */
-const LUA_PRELOAD_TABLE = "_PRELOAD";
+const LUA_PRELOAD_TABLE = lua.to_luastring("_PRELOAD");
-const LUA_FILEHANDLE = lua.to_luastring("FILE*", true);
+const LUA_FILEHANDLE = lua.to_luastring("FILE*");
const LUAL_NUMSIZES = 4*16 + 8;
@@ -57,7 +57,7 @@ const findfield = function(L, objidx, level) {
const pushglobalfuncname = function(L, ar) {
let top = lua.lua_gettop(L);
lua.lua_getinfo(L, ['f'.charCodeAt(0)], ar); /* push function */
- lua.lua_getfield(L, lua.LUA_REGISTRYINDEX, lua.to_luastring(LUA_LOADED_TABLE, true));
+ lua.lua_getfield(L, lua.LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
if (findfield(L, top + 1, 2)) {
let name = lua.lua_tostring(L, -1);
if (name[0] === "_".charCodeAt(0) && name[1] === "G".charCodeAt(0) && name[2] === ".".charCodeAt(0)) { /* name start with '_G.'? */
@@ -513,7 +513,7 @@ const luaL_tolstring = function(L, idx) {
** Leaves resulting module on the top.
*/
const luaL_requiref = function(L, modname, openf, glb) {
- luaL_getsubtable(L, lua.LUA_REGISTRYINDEX, lua.to_luastring(LUA_LOADED_TABLE));
+ luaL_getsubtable(L, lua.LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
lua.lua_getfield(L, -1, modname); /* LOADED[modname] */
if (!lua.lua_toboolean(L, -1)) { /* package not already loaded? */
lua.lua_pop(L, 1); /* remove field */