Zan 99 Posted January 25, 2017 Share Posted January 25, 2017 How can i run Lua.LuaDoString 5 times rather than have 5 lines in my code? Link to comment Share on other sites More sharing options...
iMod 99 Posted January 25, 2017 Share Posted January 25, 2017 18 minutes ago, Zan said: How can i run Lua.LuaDoString 5 times rather than have 5 lines in my code? i'm not sure and did not test it but try Lua.LuaDoString(new List<string>() { "FirstCommand", "Second command", "ThirdCommand" }); Link to comment Share on other sites More sharing options...
Droidz 2722 Posted January 25, 2017 Share Posted January 25, 2017 Hello, iMod method is good, but you can also use @ http://net-informations.com/q/faq/multilines.html (method 1) like: int numberPetAlive = Lua.LuaDoString<int>(@" local aliveCount = 0; for p=1, 3 do local petID, ability1ID, ability2ID, ability3ID, locked = C_PetJournal.GetPetLoadOutInfo(p); if petID then local health, maxHealth, _ = C_PetJournal.GetPetStats(petID); if health > 0 then aliveCount = aliveCount + 1; end end end return aliveCount;"); Link to comment Share on other sites More sharing options...
Zan 99 Posted January 26, 2017 Author Share Posted January 26, 2017 Thank you both! I appreciate the help! Link to comment Share on other sites More sharing options...
Zan 99 Posted April 25, 2017 Author Share Posted April 25, 2017 I found an easy way that could be used universally with c#: private static void RepeatAction(int repeatCount, Action action) { for (int i = 0; i < repeatCount; i++) action(); } Then in the profile: RepeatAction(5, () => { // Action to repeat 5 times. }); Link to comment Share on other sites More sharing options...
camelot10 155 Posted April 26, 2017 Share Posted April 26, 2017 for (var i = 1; i <= 5; i++) Lua.DoString("print('go ducks')"); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now