[JW Lua] FCString:CreateEnigmaStrings doesn't work on long unicode strings, but on short ones

Jan Angermüller jan at angermueller.com
Wed Jul 8 18:30:09 CEST 2015


Jari,

you are right that using FCString() functions is preferred over Lua 
functions.
But it's not the non-FCString() functions that are causing the problem 
in this case.
It is (most probably) the CreateEnigmaStrings().

I attached below the same script - this time with FCString()-functions only.
It's the same result: i.LuaString is empty when three or more unicode 
characters are appended.

Best regards,
Jan

function SplitEnigma(text)
      --Create enigma strings and print all non-enigma commands (i.e. 
all texts)
      print("String to split:",text.LuaString)
      local splittext=text:CreateEnigmaStrings(true)
      for i in each(splittext) do
          if not i:IsEnigmaCommand() then
             print("String:",i.LuaString)
          end
      end
end


local text=finale.FCString()
text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"
text:AppendCharacter(0xe050)
SplitEnigma(text)

text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"
text:AppendCharacter(0xe050)
text:AppendCharacter(0xe050)
SplitEnigma(text)

text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"
text:AppendCharacter(0xe050)
text:AppendCharacter(0xe050)
text:AppendCharacter(0xe050)
SplitEnigma(text)

text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"
text:AppendCharacter(0xe050)
text:AppendCharacter(0xe050)
text:AppendCharacter(0xe050)
text:AppendCharacter(0xe050)

SplitEnigma(text)
text.LuaString="^fontMus(Bravura,8192)^size(24)^nfx(0)"
text:AppendCharacter(123)
text:AppendCharacter(123)
text:AppendCharacter(123)
text:AppendCharacter(123)
SplitEnigma(text)

Running [Unnamed Script] ======>
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)
String: 
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)
String: 
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)
String: -- Empty !
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0)
String: -- Empty !
String to split: ^fontMus(Bravura,8192)^size(24)^nfx(0){{{{
String: {{{{
<======= [Unnamed Script] succeeded (Processing time: 0.000 s).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150708/2b906479/attachment.htm>


More information about the JWLua mailing list