PolycodeModule.lua 629 B

1234567891011121314151617181920212223242526272829303132333435
  1. class "PolycodeModule"
  2. TYPE_GENERIC = 0
  3. TYPE_SHADER = 0
  4. function PolycodeModule:PolycodeModule(...)
  5. for k,v in pairs(arg) do
  6. if type(v) == "table" then
  7. if v.__ptr ~= nil then
  8. arg[k] = v.__ptr
  9. end
  10. end
  11. end
  12. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  13. self.__ptr = Polycore.PolycodeModule(unpack(arg))
  14. Polycore.__ptr_lookup[self.__ptr] = self
  15. end
  16. end
  17. function PolycodeModule:getType()
  18. local retVal = Polycore.PolycodeModule_getType(self.__ptr)
  19. return retVal
  20. end
  21. function PolycodeModule:__delete()
  22. Polycore.__ptr_lookup[self.__ptr] = nil
  23. Polycore.delete_PolycodeModule(self.__ptr)
  24. end