Jump to content

BSL:Manual: Difference between revisions

146 bytes added ,  1 November 2017
wow reading oni memory from bsl, undefined behavior at its best? Probably this should be patched.
(BSL subtraction operator can be very tricky!)
(wow reading oni memory from bsl, undefined behavior at its best? Probably this should be patched.)
Line 520: Line 520:
Trying to give a string a non-textual value (bool/int/float) gives the error "illegal type convertion" (sic). Trying to add two strings together simply crashes the game, rather than concatenating them as it would in some other languages. Adding a float to a string crashes too. Bools have no effect whatsoever.
Trying to give a string a non-textual value (bool/int/float) gives the error "illegal type convertion" (sic). Trying to add two strings together simply crashes the game, rather than concatenating them as it would in some other languages. Adding a float to a string crashes too. Bools have no effect whatsoever.


Trying to add an int value to a string creates some cool and unexpected results. For instance, adding a number between 5 and 11 removes the first character from the string. A number greater than or equal to 12 removes the first two, and so on. Subtraction does not yield the reverse effect, even if you try it with the maximum int value (in which case, Oni crashes).
Trying to add an int value to a string creates some cool and unexpected results. For instance, adding a number between 5 and 11 removes the first character from the string. A number greater than or equal to 12 removes the first two, and so on. Subtraction does not yield the reverse effect, even if you try it with the maximum int value (in which case, Oni crashes). Subtracting random numbers can result in read random strings from Oni memory, for instance you can even read loaded BSL functions names this way.


"(null)" is the value that strings assume when they have not been given a value yet; it cannot be assigned to a string manually.
"(null)" is the value that strings assume when they have not been given a value yet; it cannot be assigned to a string manually.
489

edits