Closed BugRoger closed 3 years ago
The script language is not quite Golang is it? ;)
You're right, it's not quite like Golang but very similar.
[]uint8 // odd, isn't this supposed to be byte[] according to the docs?
byte
is actually an uint8
.
see https://golang.org/src/builtin/builtin.go?s=2701:2718#L78
[40] // where did the 41 go? first bit was eaten somewhere
The KNX protocol defines that scene numbers start at value 0
. But for users they start at 1
.
Scene 41
is actually the byte value 40
. 😉
[40 1] // wierd. in the golang playground this throws: mismatched types []uint8 and int. Some autoboxing going on here
The scripts lets you append values to an array using the +
-operator like this.
var array = [10]
println(array + 1) // [10, 1]
Note that this is not possible in Go. In Go you would have to use the append
method.
var array = []uint8{10}
println(append(array, 1)) // [10, 1]
40 // Ok
See above.
1 // What?
This seems weird for me as well. 🤔
Some of the usual if err := hkknx.GroupWrite(); err != nil {} idioms also throw syntax errors.
First, the :=
assignment operator is not supported. You have to use =
instead.
Secondly, the scripting language doesn't allow variable definitions inside an if-statement.
I'm having trouble understanding what's going on here:
This happens when I write a
41
to0/5/0
which is DPT18.001.Some of the usual
if err := hkknx.GroupWrite(); err != nil {}
idioms also throw syntax errors. The script language is not quite Golang is it? ;)