sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 268 forks source link

Fix boolean values - should be T_BOOL, not T_INT #335

Closed MarkusBauer closed 2 years ago

MarkusBauer commented 2 years ago

Currently boolean values are created by sciter.NewValue as T_INT, while sciter has T_BOOL for this. In Javascript, values are therefore represented as 1 and 0 instead of true and false. The code to properly set booleans is already present.

The bug can be reproduced by this code:

v0 := sciter.NewValue(false)
println(v0.IsBool(), v0.Bool(), v0.IsInt())
v1 := sciter.NewValue(true)
println(v1.IsBool(), v1.Bool(), v1.IsInt())

The expected output should be `true false false / true true false, but is false false true / false true true.