It needs an event handler - it is an event; which can happen at (almost) any-time.You've included a receive side function. Is pasting it sufficient, or does it also need a registered event handler?
I'm trying to update the Lua system functions give meaningful error messages as I have occasion to work on each one...!...Put it in a script, and k,error = raiseInterProfileEvent() returned
"raiseInterProfileEvent: missing at least one argument (a string, number, boolean, or nil
expected, got nothing!)..."
Yes, as it takes a variable (non-zero as you have discovered) number of arguments so the primary return value on success is the number of arguments it processed and sent.I changed it to raiseInterProfileEvent("teststring"), and it's now returning 1,nil....
Um, yes, I cut and pasted and neglected to tweak the code snippet to not include variables declared in a higher level table (profileInterLink) that I was using to count the messages sent and received and the last message....and modified the script event (example: profileInterLink.received or for that matter profileInterLink are never defined in it.
As Vadi pointed out this event was created separately to the raiseEvent one, because unlike that one that the user / scripter can generate from a profile (and pretty much all the ones that Mudlet sends to to a profile) it is sent (and that is its design intention obviously) between profiles. raiseGlobalEvent is a little shorter I suppose - but it perhaps doesn't obviously suggest (to me, at least) why it is such a different function. OTOH I'm looking at it from an application coding environment where there are a number of events and most are confined to one Host(profile) instance whereas the user/scripter is most likely only looking at sending and receiving the results of raiseEvent with various arguments and the reception of other system events.
For the record the other events that are global or sent to all profiles are the sysIrcMessage and, effectively the sysExitEvent when the Mudlet application is shutdown (although in the case when it asks about whether to save each profile in turn, each profile gets that event before the question is asked so there can be seconds between each profile receiving the event!)