Jump to content

How to implement Lua functions in C#


MrBottie

Recommended Posts

Hey all,

Just want to know if it's possible to implement the lua code below into C# fight class and if it's possible, I want to know how to do it.

Basically, I want to know the calculated "Time To Die" of my target. 

Lua Example

https://github.com/BadBoy-Ultimate-Raider/BadBoy/blob/39eb9363599d3679bef5500ee5644877f350b9ce/System/engines/ttdTable.lua

 

Thx in advance

Link to comment
Share on other sites

52 minutes ago, Brian said:

Lua.LuaDoString<string>("UnitIsDead('target')")

I know you can do this to retrieve a bool or a string or whatever you want but it's a bit more complicated than that

Link to comment
Share on other sites

1 hour ago, MrBottie said:

I know you can do this to retrieve a bool or a string or whatever you want but it's a bit more complicated than that

If you want to retrieve multiple values;

 

a,b,c,d,e,f,g =  Lua.LuaDoString<string>("UnitIsDead('target'));

a,b,c.. are the respective values in order

Link to comment
Share on other sites

4 hours ago, Brian said:

If you want to retrieve multiple values;

 

a,b,c,d,e,f,g =  Lua.LuaDoString<string>("UnitIsDead('target'));

a,b,c.. are the respective values in order

That way it's not possible. Or you use an foreach loop or an switch construction.

But a,b,... stands for what ?

 

Link to comment
Share on other sites

3 hours ago, Pasterke said:

That way it's not possible. Or you use an foreach loop or an switch construction.

But a,b,... stands for what ?

 

string name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, 
shouldConsolidate, spellId = Lua.LuaDoString<string>("BuffStatus('target','Hunter's Mark')"); 
Link to comment
Share on other sites

58 minutes ago, Brian said:

string name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, 
shouldConsolidate, spellId = Lua.LuaDoString<string>("BuffStatus('target','Hunter's Mark')"); 

You can try :

string[] result = Lua.LuaDoString<string>("local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId=what you want to check",0);

then result[0] should contains name, result[1] rank etc ...

Link to comment
Share on other sites

1 hour ago, Pasterke said:

You can try :

string[] result = Lua.LuaDoString<string>("local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId=what you want to check",0);

then result[0] should contains name, result[1] rank etc ...

This is for OP, not for me :P, I use it just fine

Link to comment
Share on other sites

11 hours ago, Pasterke said:

You can try :

string[] result = Lua.LuaDoString<string>("local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId=what you want to check",0);

then result[0] should contains name, result[1] rank etc ...

I just want to know if it's possible to integrate the Time To Die LUA functions above in C#

And if so... how? :)

Link to comment
Share on other sites

  • 3 weeks later...

Hello, like this:

            bool isDead = Lua.LuaDoString<bool>("return UnitIsDead('target')");
            string spellName = Lua.LuaDoString<string>("local name, rank, icon, castingTime, minRange, maxRange, spellID = GetSpellInfo(1); return name;");
            // only in next wrobot version
            List<string> returnGetSpellInfo = Lua.LuaDoString<List<string>>("return GetSpellInfo(1);");
            string spellName2 = returnGetSpellInfo[0];

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...