BasicFile.lua 940 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. class "BasicFile"
  2. function BasicFile:__getvar(name)
  3. if name == "file" then
  4. local retVal = Polycore.BasicFile_get_file(self.__ptr)
  5. if retVal == nil then return nil end
  6. local __c = _G["FILE"]("__skip_ptr__")
  7. __c.__ptr = retVal
  8. return __c
  9. end
  10. end
  11. function BasicFile:__setvar(name,value)
  12. return false
  13. end
  14. function BasicFile:read(ptr, size, count)
  15. local retVal = Polycore.BasicFile_read(self.__ptr, ptr.__ptr, size.__ptr, count.__ptr)
  16. return retVal
  17. end
  18. function BasicFile:write(ptr, size, count)
  19. local retVal = Polycore.BasicFile_write(self.__ptr, ptr.__ptr, size.__ptr, count.__ptr)
  20. return retVal
  21. end
  22. function BasicFile:seek(offset, origin)
  23. local retVal = Polycore.BasicFile_seek(self.__ptr, offset, origin)
  24. return retVal
  25. end
  26. function BasicFile:tell()
  27. local retVal = Polycore.BasicFile_tell(self.__ptr)
  28. return retVal
  29. end
  30. function BasicFile:__delete()
  31. if self then Polycore.delete_BasicFile(self.__ptr) end
  32. end