hex2dec
I am creating a sysex stream with [ midiout ]
and it would be handy if [ hex2dec ]
worked, so I could use the same hex strings as are found in the docs and scripts in other languages, without having to convert them all to decimal myself.
When I looked at help for [ hex2dec ]
, I see doesn't seem to work
, and indeed when I try different things, it doesn't output what I would expect:
[f 100] => "symbol"
[ 100 ( => "symbol"
[ symbol 100 ] => "symbol"
[ list 100 100 ( => "symbol"
I expect all of these to output 256
(float).
I had a look at the code, and it looks ok, at least from my cursory 5 minute perusal.
I've been meaning to get better with pdlua
, so I implemented it this way, as it was quick & easy, and it illustrates my expectations. Is there interest in a PR? Can I do it in lua, or should it be in the original C code?
Here is my lua version: hex2dec.zip