Log In  


Cart #knutil_htd-0 | 2023-08-08 | Code ▽ | Embed ▽ | No License

Feature Overview

HTD() Split a continuous string of hexadecimal numbers into a table.

  • the number of supported delimited bits is 4,8,12,16 bits (1~4 nibbles).
  • characters that cannot be converted to numbers are ignored.
    • the result of the api's tonum('0x'..v) of the api.
  • depending on the delimiter, a missing last character will result in a lower digit by the number of missing characters.
  • This function consumes 30 Token.
local a=htd('12a30f',1) -- a={1,2,10,3,0,15}
local b=htd('12a30f',3) -- b={297,783}

Perhaps consider BUNPACK() if you want to separate NUMBER every few bits.

This function is included in the KNUTIL library.

release note


v0.1

  • first release


we don’t need the "0x".. trick anymore! https://www.lexaloffle.com/dl/docs/pico-8_manual.html#TONUM


Hi, @merwok

Yes, I understand that it works without "0x"...

https://www.lexaloffle.com/bbs/?pid=107594#p
Please recall this thread again.

I simply cannot say which is the better one.
However, the reason I still use this method is strongly personal convenience.
As for the function TONUM(), I want nil to be returned for any exception character that cannot be converted to a number.



[Please log in to post a comment]