If I call TriggerClientEvent with Lua and pass a table, how do I retrieve the table in C# with an EventHandler?
EventHandlers["onMyEvent"] += new Action<dynamic>(dyn =>
{
Debug.WriteLine("Received some {0}", dyn.name);
});
TriggerClientEvent('onMyEvent', -1, { name = "food" })
2 Likes
Thank you. That makes my life substantially easier. Is there any documentation for this stuff anywhere?
Hi @darmstadtium,
contactsNames = {"oi", "lol"}
TriggerClientEvent('phone:receiveContacts', source, contactsNames)
EventHandlers["phone:receiveContacts"] += (Action<dynamic>)((dynamic contacts) =>
{
});
How would you retrieve/access the list of strings? thank you
foreach (string contact in contacts)
{
}
… should work fine.
I decided to go through a JSON serialization to pass more complex data structures