AttributeBinding.lua 927 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. class "AttributeBinding"
  2. function AttributeBinding:__getvar(name)
  3. if name == "name" then
  4. return Polycode.AttributeBinding_get_name(self.__ptr)
  5. elseif name == "enabled" then
  6. return Polycode.AttributeBinding_get_enabled(self.__ptr)
  7. end
  8. end
  9. function AttributeBinding:__setvar(name,value)
  10. if name == "name" then
  11. Polycode.AttributeBinding_set_name(self.__ptr, value)
  12. return true
  13. elseif name == "enabled" then
  14. Polycode.AttributeBinding_set_enabled(self.__ptr, value)
  15. return true
  16. end
  17. return false
  18. end
  19. function AttributeBinding:AttributeBinding(...)
  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 = Polycode.AttributeBinding(unpack(arg))
  30. end
  31. end
  32. function AttributeBinding:__delete()
  33. if self then Polycode.delete_AttributeBinding(self.__ptr) end
  34. end