Hello. I'm trying to have all events dispatched to my C# code. I've been trying to figure out how to add an event listener to the Lua environment then get back the array of event descriptors from each event that's dispatched. I'm using BlackRain and BlackMagic for the injection.
Code:
local executiveFrame = CreateFrame("Frame", "CSharp_ExecutiveFrame");
executiveFrame:SetScript("OnEvent", CSharp_OnEvent); //How do I specify this in my C# code?
executiveFrame:RegisterEvent("VARIABLES_LOADED");
executiveFrame:RegisterEvent("PLAYER_LOGIN");
executiveFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
I've looked at this wonderful code by Apoc: http://www.ownedcore.com/forums/worl...ected-clr.html (C# Lua Wrapper (No ASM, Requires injected CLR))
The only problem is that I'm not familiar with the standards here as I'm brand new to this scene. I don't know what the OnyxInputHandler method/function (which term is used here?) does exactly. I'm pretty darn sure it just compiles all the arguments into a List.
Does LuaDoString take Lua code as the first parameter and execute it similar to Perl's eval? If I'm wrong how does that work?
For these three methods what is the significance of the Onyx text? Can I change that?
Code:
public static void DoString(string lua)
{
DoStringHandler(lua, "Onyx.lua", 0);
}
public static string[] GetReturnValues(string lua)
{
DoString(string.Format("OnyxInput({0})", lua));
return LuaValues.ToArray();
}
public static T GetReturnVal<T>(string lua, uint retVal)
{
DoString(string.Format("OnyxInput({0})", lua));
object tmp;
if (typeof(T) == typeof(bool))
{
tmp = LuaValues[(int)retVal] == "1";
}
else
{
tmp = (T)Convert.ChangeType(LuaValues[(int)retVal], typeof(T));
}
return (T)tmp;
}
Is the EndScene hook just when the client is finished rendering that frame?
Is it possible to run my code from the process without overwriting valuable memory? Something about a codecave?
What is this InvalidPtrCheck about? What do I need to know about it?