summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Kendrick (monotony) <rjek@rjek.com>2013-03-29 16:34:30 +0000
committerRob Kendrick (monotony) <rjek@rjek.com>2013-03-29 16:34:30 +0000
commit01828ebb328c82b9c27c649c352d7a889a17b41b (patch)
treeb4df1ef132a9aba03ffc9ff33aff246f516283d6
parent14e8479792b5476c15475e67b715d99c285a55fd (diff)
downloadluxio-01828ebb328c82b9c27c649c352d7a889a17b41b.tar.gz
Make REPLs load luxio library
-rw-r--r--lua-5.1.c4
-rw-r--r--lua-5.2.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/lua-5.1.c b/lua-5.1.c
index 3a46609..fce8665 100644
--- a/lua-5.1.c
+++ b/lua-5.1.c
@@ -17,7 +17,7 @@
#include "lauxlib.h"
#include "lualib.h"
-
+extern int luaopen_luxio(lua_State *L);
static lua_State *globalL = NULL;
@@ -110,6 +110,7 @@ static int docall (lua_State *L, int narg, int clear) {
static void print_version (void) {
l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT);
+ l_message(NULL, "Built with Luxio, Copyright 2012 Rob Kendrick <rjek+luxio@rjek.com>, Daniel Silverstone <dsilvers@digital-scurf.org>");
}
@@ -346,6 +347,7 @@ static int pmain (lua_State *L) {
if (argv[0] && argv[0][0]) progname = argv[0];
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */
+ luaopen_luxio(L); /* open luxio */
lua_gc(L, LUA_GCRESTART, 0);
s->status = handle_luainit(L);
if (s->status != 0) return 0;
diff --git a/lua-5.2.c b/lua-5.2.c
index 7614c70..36f073a 100644
--- a/lua-5.2.c
+++ b/lua-5.2.c
@@ -89,7 +89,7 @@ static lua_State *globalL = NULL;
static const char *progname = LUA_PROGNAME;
-
+extern int luaopen_luxio(lua_State *L);
static void lstop (lua_State *L, lua_Debug *ar) {
(void)ar; /* unused arg. */
@@ -182,10 +182,12 @@ static int docall (lua_State *L, int narg, int nres) {
return status;
}
-
+#define LUXIO_COPYRIGHT "Built with Luxio, Copyright 2012 Rob Kendrick <rjek+luxio@rjek.com>, Daniel Silverstone <dsilvers@digital-scurf.org>"
static void print_version (void) {
luai_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT));
luai_writeline();
+ luai_writestring(LUXIO_COPYRIGHT, sizeof(LUXIO_COPYRIGHT) - 1);
+ luai_writeline();
}
@@ -455,6 +457,8 @@ static int pmain (lua_State *L) {
luaL_checkversion(L);
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */
+ luaopen_luxio(L); /* open luxio */
+ lua_setglobal(L, "luxio");
lua_gc(L, LUA_GCRESTART, 0);
if (!args[has_E] && handle_luainit(L) != LUA_OK)
return 0; /* error running LUA_INIT */