cuberite / CuberitePluginChecker

Automated script for CI-checking Cuberite plugins
The Unlicense
3 stars 3 forks source link

Use a queue for callbacks #12

Closed madmaxoft closed 7 years ago

madmaxoft commented 7 years ago

When an API function takes a callback, the call to that callback should be postponed until the current scenario step is finished, and only then should it be executed. This helps find the following bugs:

local function commandHandler(a_Player, a_Split)
  a_Player:GetWorld():QueueTask(
    function()
      a_Player:SendMessage("BUG!")
      -- a_Player may be invalid here
    end
  )
end