summaryrefslogtreecommitdiff
path: root/lib/LuaHandle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LuaHandle.cc')
-rw-r--r--lib/LuaHandle.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc
index 587dabd..a1e5ccb 100644
--- a/lib/LuaHandle.cc
+++ b/lib/LuaHandle.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: LuaHandle.cc,v 1.22 2007-05-30 11:57:10 pixel Exp $ */
+/* $Id: LuaHandle.cc,v 1.23 2008-01-21 17:19:07 pixel Exp $ */
#include "LuaHandle.h"
@@ -63,6 +63,7 @@ class sLuaHandle : public Base {
static int bseek(lua_State * L);
static int btell(lua_State * L);
static int exists(lua_State * L);
+ static int get_nb_handles(lua_State * L);
private:
static int read(lua_State * L, int);
static int write(lua_State * L, int);
@@ -480,6 +481,14 @@ int sLuaHandle::setz(lua_State * __L) {
return 0;
}
+int sLuaHandle::get_nb_handles(lua_State * __L) {
+ Lua * L = Lua::find(__L);
+
+ L->push((lua_Number) Handle::GetNbHandles());
+
+ return 1;
+}
+
int sLuaHandle::seek(lua_State * __L) {
Lua * L = Lua::find(__L);
int n = L->gettop();
@@ -691,4 +700,6 @@ void LuaHandle::pushconstruct(Lua * L) {
L->push("SEEK_END");
L->push((lua_Number) SEEK_END);
L->settable(LUA_GLOBALSINDEX);
+
+ L->declarefunc("get_nb_handles", sLuaHandle::get_nb_handles);
}