aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-11 14:02:23 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-11 15:19:18 +1000
commite7cf17565e26dc5c4a100688526b0dfed1220e44 (patch)
treeee4606b23f9c62ecf0e6da20dcbf0472d5339fd9 /src
parentbe3f9810115cbaded69be37ebc3d088ee252a225 (diff)
downloadfengari-e7cf17565e26dc5c4a100688526b0dfed1220e44.tar.gz
fengari-e7cf17565e26dc5c4a100688526b0dfed1220e44.tar.bz2
fengari-e7cf17565e26dc5c4a100688526b0dfed1220e44.zip
Move luaL_openlibs from lauxlib to lualib
Diffstat (limited to 'src')
-rw-r--r--src/fengari.js4
-rw-r--r--src/lauxlib.js2
-rw-r--r--src/linit.js26
-rw-r--r--src/lualib.js5
4 files changed, 20 insertions, 17 deletions
diff --git a/src/fengari.js b/src/fengari.js
index abbf2a4..3d35334 100644
--- a/src/fengari.js
+++ b/src/fengari.js
@@ -2,6 +2,8 @@
const lua = require('./lua.js');
const lauxlib = require('./lauxlib.js');
+const lualib = require('./lualib.js');
-module.exports.lua = lua;
+module.exports.lua = lua;
module.exports.lauxlib = lauxlib;
+module.exports.lualib = lualib;
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 4f55e13..38402c2 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -2,7 +2,6 @@
"use strict";
const lua = require('./lua.js');
-const linit = require('./linit.js');
/* key, in the registry, for table of loaded modules */
const LUA_LOADED_TABLE = "_LOADED";
@@ -798,7 +797,6 @@ module.exports.luaL_loadstring = luaL_loadstring;
module.exports.luaL_newlib = luaL_newlib;
module.exports.luaL_newmetatable = luaL_newmetatable;
module.exports.luaL_newstate = luaL_newstate;
-module.exports.luaL_openlibs = linit.luaL_openlibs;
module.exports.luaL_opt = luaL_opt;
module.exports.luaL_optinteger = luaL_optinteger;
module.exports.luaL_optlstring = luaL_optlstring;
diff --git a/src/linit.js b/src/linit.js
index 4139f20..90ad978 100644
--- a/src/linit.js
+++ b/src/linit.js
@@ -13,21 +13,21 @@ const loslib = require('./loslib.js');
const loadlib = require('./loadlib.js');
const lualib = require('./lualib.js');
-const loadedlibs = {
- [lualib.LUA_LOADLIBNAME]: loadlib.luaopen_package,
- [lualib.LUA_COLIBNAME]: lcorolib.luaopen_coroutine,
- [lualib.LUA_DBLIBNAME]: ldblib.luaopen_debug,
- [lualib.LUA_MATHLIBNAME]: lmathlib.luaopen_math,
- [lualib.LUA_OSLIBNAME]: loslib.luaopen_os,
- [lualib.LUA_STRLIBNAME]: lstrlib.luaopen_string,
- [lualib.LUA_TABLIBNAME]: ltablib.luaopen_table,
- [lualib.LUA_UTF8LIBNAME]: lutf8lib.luaopen_utf8,
- "_G": lbaselib.luaopen_base
-};
+const luaL_openlibs = function(L) {
+ const loadedlibs = {
+ [lualib.LUA_LOADLIBNAME]: loadlib.luaopen_package,
+ [lualib.LUA_COLIBNAME]: lcorolib.luaopen_coroutine,
+ [lualib.LUA_DBLIBNAME]: ldblib.luaopen_debug,
+ [lualib.LUA_MATHLIBNAME]: lmathlib.luaopen_math,
+ [lualib.LUA_OSLIBNAME]: loslib.luaopen_os,
+ [lualib.LUA_STRLIBNAME]: lstrlib.luaopen_string,
+ [lualib.LUA_TABLIBNAME]: ltablib.luaopen_table,
+ [lualib.LUA_UTF8LIBNAME]: lutf8lib.luaopen_utf8,
+ "_G": lbaselib.luaopen_base
+ };
-if (!WEB) loadedlibs[lualib.LUA_IOLIBNAME] = require('./liolib.js').luaopen_io;
+ if (!WEB) loadedlibs[lualib.LUA_IOLIBNAME] = require('./liolib.js').luaopen_io;
-const luaL_openlibs = function(L) {
/* "require" functions from 'loadedlibs' and set results to global table */
for (let lib in loadedlibs) {
lauxlib.luaL_requiref(L, lua.to_luastring(lib), loadedlibs[lib], 1);
diff --git a/src/lualib.js b/src/lualib.js
index ed02273..b3ba5f8 100644
--- a/src/lualib.js
+++ b/src/lualib.js
@@ -1,7 +1,8 @@
/*jshint esversion: 6 */
"use strict";
-const lua = require("./lua.js");
+const lua = require("./lua.js");
+const linit = require('./linit.js');
const LUA_VERSUFFIX = "_" + lua.LUA_VERSION_MAJOR + "_" + lua.LUA_VERSION_MINOR;
module.exports.LUA_VERSUFFIX = LUA_VERSUFFIX;
@@ -47,3 +48,5 @@ module.exports[LUA_DBLIBNAME] = require("./ldblib.js").luaopen_debug;
const LUA_LOADLIBNAME = "package";
module.exports.LUA_LOADLIBNAME = LUA_LOADLIBNAME;
module.exports[LUA_LOADLIBNAME] = require("./loadlib.js").luaopen_package;
+
+module.exports.luaL_openlibs = linit.luaL_openlibs;