ionio-lang / ivy-elements

Fork of Ivy Language to write Elements Smart Contracts
https://ionio-lang.org
MIT License
0 stars 3 forks source link

Add `.substr` function #20

Open altafan opened 2 years ago

altafan commented 2 years ago

We want this function available for the bytes built-in type. Ideally one could write for example:

const a = bytes(0xaabbcc)
let b = a.substr(1,2)

At the moment I think this method could be implemented either in pure js or by making use of the OP_SUBSTR_LAZY opcode.

Still need to understand what's the preferred choice.

tiero commented 2 years ago

Still need to understand what's the preferred choice.

Always depends where the data is coming from: ie. from execution/computation or is is an hardcoded value (ie. PUSHDATA)