diff options
Diffstat (limited to 'lib/LuaHandle.cc')
-rw-r--r-- | lib/LuaHandle.cc | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index 4e749da..12b33fd 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -1043,7 +1043,8 @@ bool HandleLua::CanRead() const { return false; } - L->call(0, 1); + L->insert(-2); + L->call(1, 1); r = L->toboolean(); L->pop(); L->pop(); @@ -1063,7 +1064,8 @@ bool HandleLua::CanWrite() const { return false; } - L->call(0, 1); + L->insert(-2); + L->call(1, 1); r = L->toboolean(); L->pop(); L->pop(); @@ -1083,7 +1085,8 @@ bool HandleLua::CanSeek() const { return false; } - L->call(0, 1); + L->insert(-2); + L->call(1, 1); r = L->toboolean(); L->pop(); L->pop(); @@ -1103,7 +1106,8 @@ bool HandleLua::CanWatch() const { return false; } - L->call(0, 1); + L->insert(-2); + L->call(1, 1); r = L->toboolean(); L->pop(); L->pop(); @@ -1122,8 +1126,9 @@ String HandleLua::GetName() const { L->pop(); return "LuaHandleNoName"; } - - L->call(0, 1); + + L->insert(-2); + L->call(1, 1); r = L->tostring(); L->pop(); L->pop(); @@ -1143,7 +1148,8 @@ off_t HandleLua::tell() const { return -1; } - L->call(0, 1); + L->insert(-2); + L->call(1, 1); r = L->tonumber(); L->pop(); L->pop(); @@ -1163,7 +1169,8 @@ ssize_t HandleLua::GetSize() const { return -1; } - L->call(0, 1); + L->insert(-2); + L->call(1, 1); r = L->tonumber(); L->pop(); L->pop(); @@ -1183,7 +1190,8 @@ time_t HandleLua::GetModif() const { return 0; } - L->call(0, 1); + L->insert(-2); + L->call(1, 1); r = L->tonumber(); L->pop(); L->pop(); @@ -1200,7 +1208,8 @@ void HandleLua::Flush() { return; } - L->call(0, 0); + L->insert(-2); + L->call(1, 0); L->pop(); } @@ -1216,9 +1225,10 @@ off_t HandleLua::seek(off_t offset, int wheel) throw (GeneralException) { throw GeneralException("This HandleLua doesn't have any seek method (or can't seek maybe)."); } + L->insert(-2); L->push((lua_Number) offset); L->push((lua_Number) wheel); - L->call(2, 1); + L->call(3, 1); r = L->tonumber(); L->pop(); @@ -1238,9 +1248,10 @@ ssize_t HandleLua::read(void * buf, size_t count) throw (GeneralException) { throw GeneralException("This HandleLua doesn't have any read method (or can't read maybe)."); } + L->insert(-2); L->push(buf); L->push((lua_Number) count); - L->call(2, 2); + L->call(3, 2); r = L->tonumber(-2); @@ -1274,9 +1285,10 @@ ssize_t HandleLua::write(const void * buf, size_t count) throw (GeneralException throw GeneralException("This HandleLua doesn't have any write method (or can't write maybe)."); } + L->insert(-2); L->push(buf); L->push((lua_Number) count); - L->call(2, 1); + L->call(3, 1); r = L->tonumber(); |