Brian 10 Posted March 31, 2016 Share Posted March 31, 2016 So, I know you can do this string name = Lua.LuaDoString<string>("name = UnitAura('player', 'BUFF_NAME'); return name; "); string rank = Lua.LuaDoString<string>("name,rank = UnitAura('player', 'BUFF_NAME'); return rank; "); string icon = Lua.LuaDoString<string>("name,rank,icon = UnitAura('player', 'BUFF_NAME'); return icon; "); //etc.. for all Is there a better way to return all the different properties of UnitAura into c# variables? Link to comment https://wrobot.eu/forums/topic/2867-c-lua-to-multiple-variables/ Share on other sites More sharing options...
AudreyH 17 Posted April 2, 2016 Share Posted April 2, 2016 If i see this example from Droidz (http://wrobot.eu/forums/topic/2493-luascript-in-is-complete-condition/), it's not possible int shipmentCapacity = wManager.Wow.Helpers.Lua.LuaDoString<int>("local name, texture, shipmentCapacity, shipmentsTotal, creationTime, duration, timeLeftString, itemName, itemIcon, itemQuality, itemID = C_Garrison.GetLandingPageShipmentInfo(); return shipmentCapacity;"); int shipmentsTotal = wManager.Wow.Helpers.Lua.LuaDoString<int>("local name, texture, shipmentCapacity, shipmentsTotal, creationTime, duration, timeLeftString, itemName, itemIcon, itemQuality, itemID = C_Garrison.GetLandingPageShipmentInfo(); return shipmentsTotal;"); return shipmentsTotal >= shipmentCapacity; I tried to return in a structure or in a Tuple, but that is not possible too Link to comment https://wrobot.eu/forums/topic/2867-c-lua-to-multiple-variables/#findComment-13207 Share on other sites More sharing options...
Droidz 2738 Posted April 2, 2016 Share Posted April 2, 2016 Hello, like this: var r = Lua.LuaDoString<List<string>>( string.Format(@"local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, canStealOrPurge, shouldConsolidate, spellId, canApplyAura, isBossDebuff, isCastByPlayer = UnitAura('player', 'BUFF_NAME'); return name .. '{0}' .. rank .. '{0}' .. icon;", Lua.ListSeparator)); if (r != null && r.Count == 3) { var name = r[0]; var rank = r[1]; var icon = r[2]; } Brian 1 Link to comment https://wrobot.eu/forums/topic/2867-c-lua-to-multiple-variables/#findComment-13210 Share on other sites More sharing options...
AudreyH 17 Posted April 2, 2016 Share Posted April 2, 2016 Masters answer :) Brian 1 Link to comment https://wrobot.eu/forums/topic/2867-c-lua-to-multiple-variables/#findComment-13223 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