← Back to team overview

mudlet-makers team mailing list archive

[Bug 1536788] [NEW] raiseEvent silently ignores arguments with invalid types.

 

Public bug reported:

In the current implementation, raiseEvent only accepts strings, numbers,
and booleans as arguments. Any other arguments are simply left out of
the argument list that's passed to any event handler functions,
resulting in a shorter argument list than was provided to raiseEvent.
For example, if you make an event handler for "test" that does

function test(...)
    display(...)
end

and do

raiseEvent("test","arg1",nil,"arg3)

you'll get

{
    "test",
    "arg1",
    "arg3"
}

and the same if you raiseEvent("test","arg1",{"arg2"},"arg3"). Simply
dropping the invalid arguments seems undesirable. I would expect,
instead, that raiseEvent() would simply return an error if passed an
argument that it couldn't process.

Probably also a good idea to allow as many types as possible. It should
be simple enough to allow nil arguments. Tables might be possible, but
would be trickier, at least.

** Affects: mudlet
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1536788

Title:
  raiseEvent silently ignores arguments with invalid types.

Status in Mudlet:
  New

Bug description:
  In the current implementation, raiseEvent only accepts strings,
  numbers, and booleans as arguments. Any other arguments are simply
  left out of the argument list that's passed to any event handler
  functions, resulting in a shorter argument list than was provided to
  raiseEvent. For example, if you make an event handler for "test" that
  does

  function test(...)
      display(...)
  end

  and do

  raiseEvent("test","arg1",nil,"arg3)

  you'll get

  {
      "test",
      "arg1",
      "arg3"
  }

  and the same if you raiseEvent("test","arg1",{"arg2"},"arg3"). Simply
  dropping the invalid arguments seems undesirable. I would expect,
  instead, that raiseEvent() would simply return an error if passed an
  argument that it couldn't process.

  Probably also a good idea to allow as many types as possible. It
  should be simple enough to allow nil arguments. Tables might be
  possible, but would be trickier, at least.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1536788/+subscriptions


Follow ups