CoreFileExtension.lua 979 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. class "CoreFileExtension"
  2. function CoreFileExtension:__getvar(name)
  3. if name == "extension" then
  4. return Polycore.CoreFileExtension_get_extension(self.__ptr)
  5. elseif name == "description" then
  6. return Polycore.CoreFileExtension_get_description(self.__ptr)
  7. end
  8. end
  9. function CoreFileExtension:__setvar(name,value)
  10. if name == "extension" then
  11. Polycore.CoreFileExtension_set_extension(self.__ptr, value)
  12. return true
  13. elseif name == "description" then
  14. Polycore.CoreFileExtension_set_description(self.__ptr, value)
  15. return true
  16. end
  17. return false
  18. end
  19. function CoreFileExtension:CoreFileExtension(...)
  20. local arg = {...}
  21. for k,v in pairs(arg) do
  22. if type(v) == "table" then
  23. if v.__ptr ~= nil then
  24. arg[k] = v.__ptr
  25. end
  26. end
  27. end
  28. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  29. self.__ptr = Polycore.CoreFileExtension(unpack(arg))
  30. end
  31. end
  32. function CoreFileExtension:__delete()
  33. if self then Polycore.delete_CoreFileExtension(self.__ptr) end
  34. end