osc.go 280 B

1234567891011121314
  1. package main
  2. import "github.com/hypebeast/go-osc/osc"
  3. // Generic function to get message argument of given type
  4. func getOSC[T any](msg *osc.Message) T {
  5. var zero T
  6. for _, arg := range msg.Arguments {
  7. if _, isType := arg.(T); isType {
  8. return arg.(T)
  9. }
  10. }
  11. return zero
  12. }