Logic Machine Forum
ASCII char. in an objet string - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: ASCII char. in an objet string (/showthread.php?tid=2608)



ASCII char. in an objet string - SigmaTec - 23.04.2020

Hi all the LM community,

For my Lua scripts : 
I'm looking for how to insert special characters (ASCII table: eg Ohm, diameter ...) in a "string" object (example type 16.14 oct. ASCII string).
And also how to take LM into account several "space" characters in these strings: by default it concatenates them into a single character.


Any idea ?

BR from France.
Thank's in adance for your answer.


RE: ASCII char. in an objet string - admin - 23.04.2020

You can use any UTF-8 characters but it is advised to use 250-byte string object because other type are too short.
Spaces are collapsed by your browser, it's how HTML works. You can use no-break space character to put several spaces together:
Code:
nbsp = string.char(0xC2, 0xA0)
grp.update('32/1/1', '123' .. nbsp .. nbsp .. 'Ω')



RE: ASCII char. in an objet string - SigmaTec - 23.04.2020

Ok, that's why it doesn't give the expected result with string.char (32) !
Now it runs correcly with your code.
Thanks again.