Inserting an item into a line in a field where the line has fewer items has an unexpected (and incorrect) result.
The bug has been confirmed by Quality Control in LC 7.x and 8.0 [
http://quality.livecode.com/show_bug.cgi?id=17590], while LC 6.7.x behaves correctly.
Set up a field with contents
Set the mouseUp handler of a button, or msg box command:
Code: Select all
put "x" into item 5 of line 1 of fld 1
The result is
A standard language should produce an Out of Range error. But an LC programmer surely wants
that is, empty items to be inserted to fill out the number of items. Producing this result in a standard language would be somewhat awkward, but is the kind of thing LiveCode does with ease.
This is the result if a variable is used rather than a field. It also works correctly on the last line of the field.
As an aside the result of
Code: Select all
put "x" into item -k of <any line> of <any container>
where k > the number of items of that line (or k = 0), is to precede the contents of the container with "x". I'd say this is also unexpected behaviour, but it is consistent and unlikely to be intentional code.