diff options
-rw-r--r-- | lib/BLua.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc index a8751be..9f33284 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.61 2008-07-05 06:24:05 pixel Exp $ */ +/* $Id: BLua.cc,v 1.62 2008-07-18 14:01:13 pixel Exp $ */ #include <stdlib.h> #include "BLua.h" @@ -85,6 +85,7 @@ class LuaStatics : public Base { static int iconv(lua_State *); static int mkdir(lua_State *); + static int time(lua_State *); static int globalindex(lua_State *); @@ -319,6 +320,14 @@ int LuaStatics::mkdir(lua_State * _L) { return 0; } +int LuaStatics::time(lua_State * _L) { + Lua * L = Lua::find(_L); + + L->push((lua_Number) ::time(NULL)); + + return 1; +} + int LuaStatics::print(lua_State * _L) { Lua * L = Lua::find(_L); @@ -487,10 +496,16 @@ void Lua::open_base() { push("mkdir"); push(LuaStatics::mkdir); settable(); + push("time"); + push(LuaStatics::time); + settable(); lua_pop(L, 1); push("mkdir"); push(LuaStatics::mkdir); settable(LUA_GLOBALSINDEX); + push("time"); + push(LuaStatics::time); + settable(LUA_GLOBALSINDEX); } void Lua::open_table() { |