(including the list in addresses again)
Am Mi., 21. Aug. 2019 um 23:53 Uhr schrieb gettimothy gettimothy@zoho.com:
"1. Can't you just replace each ' in your Lua text by '' (two single quotes) before compiling the Smalltalk method string? It escapes the single quotes in the string."
How? I tried wrapping it with String Concatenation and it failed to compile.
", oldtext, ".
methodTemplateLua := 'lua ^ ''{1}'''. methodSourceLua := methodTemplateLua format: {lua copyReplaceTokens: '''' "four single quotes" with: '''''' "six single quotes"}.
Or for more comfortable reading:
lua copyReplaceTokens: (String with: $') with: (String with: $' with: $')
Still, I would avoid tinkering with the code and go with the (class) instance variable approach if possible.
Hi, there.
#printString on String does the trick:
methodTemplateLua := 'lua ^ {1}'. methodSourceLua := methodTemplateLua format: { lua printString }.
Best, Marcel Am 22.08.2019 00:26:15 schrieb Jakob Reschke forums.jakob@resfarm.de: (including the list in addresses again)
Am Mi., 21. Aug. 2019 um 23:53 Uhr schrieb gettimothy <gettimothy@zoho.com [mailto:gettimothy@zoho.com]>:
"1. Can't you just replace each ' in your Lua text by '' (two single quotes) before compiling the Smalltalk method string? It escapes the single quotes in the string."
How? I tried wrapping it with String Concatenation and it failed to compile.
", oldtext, ".
methodTemplateLua := 'lua ^ ''{1}'''. methodSourceLua := methodTemplateLua format: {lua copyReplaceTokens: '''' "four single quotes" with: '''''' "six single quotes"}.
Or for more comfortable reading:
lua copyReplaceTokens: (String with: $') with: (String with: $' with: $')
Still, I would avoid tinkering with the code and go with the (class) instance variable approach if possible.
squeak-dev@lists.squeakfoundation.org