what do you guys think about a implicit conversion between bools a numbers being added?
it shouldn't hurt existing cartridges but would allow for something like this..
local axisy = btn(3)-btn(2) |
normally you would need to write a num function that converts bools to numbers for something like this.
P#73115 2020-02-15 00:12
1
No need for a function. Just use a lookup table. Use it inline, costs 1 extra cycle iirc.
b2n={[false]=0,[true]=1} ... local axisy = b2n[btn(3)]-b2n[btn(2)] |
Oh, and no, please no implicit conversions. That tends to cause hard-to-find bugs.
P#73146 2020-02-16 04:25 ( Edited 2020-02-16 20:06)
Ah good then. For a moment I thought my function was in error. But yes it would be nice to have (var <>= var) calculate out to -1 or 1 and zero.
Gold star for your excellent question and observation, @Shadowblitz16.
P#73210 2020-02-18 18:37
[Please log in to post a comment]