is there any way to manipulate the txt editor while running by code, and make text’s code syntaxhighlight as the same as code editor?
another question: from a txt like this
$text1 ????
1. Excuse me!
???
2. Yes?
????
3. Is this your handbag?
?????????
4. Pardon?
??????????
$text2 ???
5. Is this your handbag?
?????????
6. Yes, it is.
???????
7. Thank you very much.
?????
$text3 ???????
8. My coat and my umbrella please.
????????????
9. Here is my ticket.
?????????????
10. Thank you, sir.
??????
11. Number five.
?5??
i wanna get a table, each value is for an English sentence or a Chinese sentence, i know how to make it with \
, is there any better way?
If you wanted to have Lua/ Codea syntax formatting upon text entry, you could grab a table of keys from _G and compare this against each word entered, similar to how I did the autocomplete in the Lua interpreter I posted one the board a while ago.
I’m not sure if this is what you mean by your second question, but if you’re writing multi-line text and are bored of writing
, the easiest option is to use square braces:
myString = [[a multi line string
No need to write
Back-slash n
]]
Though you can also with regular quotation marks type backslash and then a literal carriage return, like this:
myString = "a multi line string\\
with backslash literal return\\
Line endings\\
"
The second one works, though it messes up Codea’s syntax highlighting. Syntax highlighting is quite hard!
I’m not sure if that’s the best way to organise a dictionary/phrasebook though. Have you tried using keys (like the utf language codes) to represent the different languages? Eg
Phrasebook = {
{ EN = "english phrase here", ZH = "Chinese phrase here"},
{ EN = "english phrase here", ZH = "Chinese phrase here"},
{ EN = "english phrase here", ZH = "Chinese phrase here"},
}
That would be a good structure if you ever decide to add more languages.
thanks, its a good structure, i changed a little:??–>text, please check out