diff options
author | pixel <pixel> | 2006-07-16 12:24:54 +0000 |
---|---|---|
committer | pixel <pixel> | 2006-07-16 12:24:54 +0000 |
commit | aa80e2d93acbd2ad9277ab3b377cb96efb8c1eaa (patch) | |
tree | 59eb11a44c3aedda7bd5afe5d2a5cdf642addb14 /lib/BLua.cc | |
parent | 309d8c1318d7e92e6f685ad2011d73f8653dd4d1 (diff) |
Adding mkdir to LUA
Fixing iconv
Fixing the hash table functions
Diffstat (limited to 'lib/BLua.cc')
-rw-r--r-- | lib/BLua.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index d86740d..7d70bb9 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.36 2006-02-09 17:08:24 pixel Exp $ */ +/* $Id: BLua.cc,v 1.37 2006-07-16 12:24:54 pixel Exp $ */ #include <stdlib.h> #include "BLua.h" @@ -77,6 +77,7 @@ class LuaStatics : public Base { static int dumpvars(lua_State *); static int iconv(lua_State *); + static int mkdir(lua_State *); static int globalindex(lua_State *); }; @@ -299,6 +300,22 @@ int LuaStatics::iconv(lua_State * _L) { return 1; } +int LuaStatics::mkdir(lua_State * _L) { + Lua * L = Lua::find(_L); + int n = L->gettop(); + String dirname; + + if (n != 1) { + L->error("Incorrect arguments to function `mkdir'"); + } + + dirname = L->tostring(1); + + ::MKDIR(dirname.to_charp()); + + return 0; +} + int LuaStatics::callwrap(lua_State * __L, lua_CFunction func) { Lua * L = Lua::find(__L); int n; @@ -419,7 +436,13 @@ Lua::Lua(const Lua & l) throw (GeneralException) { void Lua::open_base() { lock(); luaopen_base(L); + push("mkdir"); + push(LuaStatics::mkdir); + settable(); lua_pop(L, 1); + push("mkdir"); + push(LuaStatics::mkdir); + settable(LUA_GLOBALSINDEX); unlock(); } |