aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lua.js1
-rw-r--r--src/lualib.js56
2 files changed, 38 insertions, 19 deletions
diff --git a/src/lua.js b/src/lua.js
index d7bfa01..b1faccd 100644
--- a/src/lua.js
+++ b/src/lua.js
@@ -2,7 +2,6 @@
"use strict";
const assert = require('assert');
-const lualib = require('./lualib.js');
const luaconf = require('./luaconf.js');
/* mark for precompiled code ('<esc>Lua') */
diff --git a/src/lualib.js b/src/lualib.js
index da9b290..83b1d0d 100644
--- a/src/lualib.js
+++ b/src/lualib.js
@@ -1,27 +1,47 @@
/*jshint esversion: 6 */
"use strict";
-const assert = require('assert');
+const lua = require("./lua.js");
+
+const LUA_VERSUFFIX = "_" + lua.LUA_VERSION_MAJOR + "_" + lua.LUA_VERSION_MINOR;
+module.exports.LUA_VERSUFFIX = LUA_VERSUFFIX;
+
+const LUA_COLIBNAME = "coroutine";
+module.exports.LUA_COLIBNAME = LUA_COLIBNAME;
+module.exports[LUA_COLIBNAME] = require("./lcorolib.js").luaopen_coroutine;
+
+const LUA_TABLIBNAME = "table";
+module.exports.LUA_TABLIBNAME = LUA_TABLIBNAME;
+module.exports[LUA_TABLIBNAME] = require("./ltablib.js").luaopen_table;
+
+const LUA_IOLIBNAME = "io";
+module.exports.LUA_IOLIBNAME = LUA_IOLIBNAME;
+// module.exports[LUA_IOLIBNAME] = require("./liolib.js").luaopen_io;
+
+const LUA_OSLIBNAME = "os";
+module.exports.LUA_OSLIBNAME = LUA_OSLIBNAME;
+// module.exports[LUA_OSLIBNAME] = require("./loslib.js").luaopen_os;
+
+const LUA_STRLIBNAME = "string";
+module.exports.LUA_STRLIBNAME = LUA_STRLIBNAME;
+module.exports[LUA_STRLIBNAME] = require("./lstrlib.js").luaopen_string;
-const LUA_COLIBNAME = "coroutine";
-const LUA_TABLIBNAME = "table";
-const LUA_IOLIBNAME = "io";
-const LUA_OSLIBNAME = "os";
-const LUA_STRLIBNAME = "string";
const LUA_UTF8LIBNAME = "utf8";
-const LUA_BITLIBNAME = "bit32";
+module.exports.LUA_UTF8LIBNAME = LUA_UTF8LIBNAME;
+module.exports[LUA_UTF8LIBNAME] = require("./lutf8lib.js").luaopen_utf8;
+
+const LUA_BITLIBNAME = "bit32";
+module.exports.LUA_BITLIBNAME = LUA_BITLIBNAME;
+// module.exports[LUA_BITLIBNAME] = require("./lbitlib.js").luaopen_bit32;
+
const LUA_MATHLIBNAME = "math";
-const LUA_DBLIBNAME = "debug";
-const LUA_LOADLIBNAME = "package";
+module.exports.LUA_MATHLIBNAME = LUA_MATHLIBNAME;
+module.exports[LUA_MATHLIBNAME] = require("./lmathlib.js").luaopen_math;
+const LUA_DBLIBNAME = "debug";
+module.exports.LUA_DBLIBNAME = LUA_DBLIBNAME;
+module.exports[LUA_DBLIBNAME] = require("./ldebug.js").luaopen_debug;
-module.exports.LUA_BITLIBNAME = LUA_BITLIBNAME;
-module.exports.LUA_COLIBNAME = LUA_COLIBNAME;
-module.exports.LUA_DBLIBNAME = LUA_DBLIBNAME;
-module.exports.LUA_IOLIBNAME = LUA_IOLIBNAME;
+const LUA_LOADLIBNAME = "package";
module.exports.LUA_LOADLIBNAME = LUA_LOADLIBNAME;
-module.exports.LUA_MATHLIBNAME = LUA_MATHLIBNAME;
-module.exports.LUA_OSLIBNAME = LUA_OSLIBNAME;
-module.exports.LUA_STRLIBNAME = LUA_STRLIBNAME;
-module.exports.LUA_TABLIBNAME = LUA_TABLIBNAME;
-module.exports.LUA_UTF8LIBNAME = LUA_UTF8LIBNAME; \ No newline at end of file
+// module.exports[LUA_LOADLIBNAME] = require("./loadlib.js").luaopen_package;