What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Wirlo

New Member
Joined
Jun 4, 2015
Messages
37
Reaction score
0
Some lua events have objects as callback value. is there a way to use these objects ?

LuaEventArgument.String returns a hex value, when the argument is supposed to be an object.
if this is the pointer address, do i use these in C# or within lua string ?
(i guess lua might shove them around in memory or garbage collect)

i tried using this in lua
Code:
table = {}
table[0x1234AF].dosomething

im just curious, i can do a carbine ingame addon otherwise
 
Last edited:
Use the custom Lua code for the event registration.

Code:
            // Generate quest profile tags
            RegisterEvent("QuestStateChanged", Events.QuestStateChanged, "function(queQuest, eState, unk) return queQuest:GetId(), eState, unk end");


            // Quest pickup/turnin
            RegisterEvent("Dialog_ShowState",
                Events.Dialog_ShowState,
                @"function(eState, queCurr) local questId = 0 if queCurr and queCurr:GetId() then questId = queCurr:GetId() end return eState, questId end");

Code:
        private void RegisterEvent(string eventName, LuaEventCallback callback, string customEventCode = null)
        {
            _events.Add(GameManager.Lua.Events.RegisterEvent(eventName, callback, customEventCode));
        }

Code:
		public static void QuestStateChanged(string eventname, LuaEventArgument[] args)		{
			//DebugEvent(eventname, args);
			int questId = args[0];
			var state = (QuestManager.QuestState) args[1].Integer;
			bool unk = args[2];


			if (state == QuestManager.QuestState.Accepted)
			{
				QuestUtils.AttemptGenerateQuestTags(questId);
			}
		}
 
oh i see, the third argument is a lua callback, and its return goes to c# callback as LuaEventArguments.
that is neat, thx allot!
 
Last edited:
Back
Top