My question is regarding the proper formating when writing to framescript execute (dostring) for multi-line lua executions. I have seen slightly conflicting examples around here and I just wanted to be clear on how formatting should be done properly.
The best example I have seen of a long mutli-line string is as follows:
if (AccountLoginUI and AccountLoginUI:IsShown()) then AccountLoginUI:Hide(); DefaultServerLogin('" + username + "', '" + password + "'); elseif (RealmList and RealmList:IsShown()) then for i = 1, select('#',GetRealmCategories()) do for j = 1, GetNumRealms(i) do if (GetRealmInfo(i, j) == '" + realm + "') then RealmList:Hide(); ChangeRealm(i,j); end end end elseif (CharacterSelectUI and CharacterSelectUI:IsShown()) then for i=0,GetNumCharacters() do local name = GetCharacterInfo(i); if (name and name == '" + charname + "') then CharacterSelect_SelectCharacter(i); end end EnterWorld(); end
As you can see, ";" is used in many places. However, reading through the LUA documentation and from comments in some of the LUA irc channels, usually the ";" isn't neccessary. Therefore, would this string be valid when passed using dostring?
"if UnitHealth(\"player\") >= 4 then testVal = 111 end for i = 1, GetNumPartyMembers(), 1 do if UnitHealth(\"party\"..i) >= 3000 then testVal = 555 else testVal = 222 end end end"
Perhaps it is being sending in "end" statements break the localized string in some way? I am sorry if this question has been answered before.
Ideas?
**as a side note, has anyone tried working arrays into their dostring?