sannybuilder/dev

unexpected result in opcode 05AA for longer strings

x87 opened this issue · 2 comments

x87 commented
0@s = '0123456789ABCDE'

compiles with no error producing valid bytecode (opcode 05AA). but the runtime (game) limits number of chars written into 0@s to 8 characters. so 0@s contains 01234567 without a null-terminator.

need some kind of a warning to the user?

x87 commented

same happens in pretty much all opcodes that expect a short string. game cuts it to first 8 characters.
if the game expects a longer string ("double quotes"), then a long string with single quotes may work

By design SCM do not require terminator in short or long string variables, so game will always read only the correct amount of the characters.
It my opinion showcased example can be simply handled as compilation error, as for sure it is not what user meant to do (text truncation).