Console command output callback
#1
If we want to make some form of RCON-based automation, we need the plugins to be able to make command output in deferred calls (such as from within cWorld:ChunkStay() callbacks). In order to do so, we'd need to export the console command output callback interface somehow and let plugins use it. Something like:
function MyConsoleCmdHandler(a_Split, a_EntireCmd, a_Output)
  a_Output:WriteLn("Starting job")
  World:ChunkStay({{0, 0}}, nil,
    function()
      a_Output:WriteLn("Chunk loaded, block is " .. World:GetBlockType(1, 1, 1))
      a_Output:Done()  -- do we need such a thing?
    end
  )
  return true
end
There is currently no way of doing it in the current API - it is not possible to output anything into the command output once the command handler callback terminates.

There's a question about theBig Grinone() function - do we need it? How else to know that the plugin is no longer using the callback? If a poorly written plugin assigns the callback to a global variable, how do we proceed? Do we keep the callback for the rest of the plugin's life? What about the "request" that has created the callback, when does it terminate?
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)