Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
get URL "http://fr.wiktionary.org/wiki/accompagner" -- we read the source code
repeat with x = 1 to the number of lines of IT -- we want to place an index number in front of each line code
put line x of IT into tLaLigne -- we isolate each line first
set the Text of line x of IT to x&&":"&&tLaLigne -- we can't place the index number; this line makes an ERROR; why ?
end repeat
put URL "http://fr.wiktionary.org/wiki/accompagner" into Tsource
put empty into Toutput
repeat with x = 1 to the number of lines of Tsource
-- we want to place an index number in front of each line code
put x &":"& line x of Tsource &cr after Toutput
end repeat
You can check repeat for each line... in the dictionary,
and read the important notice at the end..
HTH,
Thierry
! SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
I answer to myself just to say that I found an interresting function in the LiveCode lessons.
For the same result, it use the prefixed function.
You can know more on this page: http://lessons.runrev.com/s/lessons/m/2 ... in-a-field.
set the Text of line x of IT to x&&":"&&tLaLigne -- we can't place the index number; this line makes an ERROR; why ?
the error is that you cannot "set the text of LINE X..."!
You can set the text of a field or button, but not a line in a variable or field, that was the problem.
There are two things going on here. Some entities in LC are called "containers". These are fields, variables, the message box and buttons. They "contain" data, and you manage them by;
put yourData into field 3 (or perhaps: get field 3)
put yourData into button "yourButton" (or perhaps: answer button "yourButton)
put yourData into yourVariable (or perhaps: put yourVariable into the message box)
But other entities are "properties", like:
the text of field "yourField"
the height of field "yourField"
the loc of fld "yourField"
You may "set" or "get" those values, but you cannot "put" anything into them. For example, the script of an object is a property of that object. You can change that script, but you have to "set" the property. So if you had this in a variable "newScript":
on mouseUp
beep 3
end mouseUp
You could: set the script of button "yourButton" to newScript, but you cannot: put newScript into the script of button "yourButton".
Takes a little getting used to, but you will soon become an expert,