diff options
author | pixel <pixel> | 2003-12-07 04:44:37 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-12-07 04:44:37 +0000 |
commit | b3b4fd468cb4703ceed95ed78a567bb759cdb338 (patch) | |
tree | 7d6153d25bfbf37e3babc046d3b822e328e8637c /cd-tool.cpp | |
parent | 845451a49fe822f4ccbf221e9b56889d5386713d (diff) |
LUA work work work
Diffstat (limited to 'cd-tool.cpp')
-rw-r--r-- | cd-tool.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/cd-tool.cpp b/cd-tool.cpp index bf3d879..fd123a2 100644 --- a/cd-tool.cpp +++ b/cd-tool.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: cd-tool.cpp,v 1.16 2003-12-06 04:26:16 pixel Exp $ */ +/* $Id: cd-tool.cpp,v 1.17 2003-12-07 04:44:38 pixel Exp $ */ #include <getopt.h> #include <stdio.h> @@ -38,6 +38,14 @@ #include "isobuilder.h" #include "luacd.h" +static int myprint(lua_State * L) { + const char * t = lua_tostring(L, -1); + + Base::printm(M_INFO, "From LUA: %s\n", t); + + return 0; +} + int lga = 0; struct option long_options[] = { {"help", 0, NULL, 'h'}, @@ -330,14 +338,22 @@ virtual int startup() throw (GeneralException) { } arg1 = argv[optind]; Lua * L = new Lua(); + L->open_math(); + L->open_string(); LuaInput::pushconstruct(L); LuaOutput::pushconstruct(L); LuaBuffer::pushconstruct(L); - L->push("cdutil"); + Luacdutils::pushstatics(L); + Luacdfile::pushstatics(L); + L->push("print"); + L->push(myprint); + L->settable(LUA_GLOBALSINDEX); Luacdutils lcdutil(cdutil); + L->push("cdutil"); lcdutil.push(L); L->settable(LUA_GLOBALSINDEX); L->load(&Input(arg1)); + getchar(); } else { showhelp(); printm(M_ERROR, "Command %s unknow.\n", argv[optind]); |