You could already do a few things to avoid lag - for example make the command create a description of the operation, store it in a storage and have the world tick thread do a little bit of work on the queue of such operations at a time - for example generating, say, 10 slices of a big area.
function OnCmdGenerate(...) local operation = cGenerateStructure:new(...) table.insert(g_WorkQueue[worldName], operation) end function OnWorldTick(...) local workItem = g_WorkQueue[worldName][1] if (workItem ~= nil) then workItem:doABitOfWork() if (workItem:IsFinished()) then table.remove(g_WorkQueue, 1) end end end