Commit a0a80033 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Clean up sample Lua match shutdown code.

parent 5d74bb0b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -268,9 +268,9 @@ local function match_loop(context, dispatcher, tick, state, messages)
    print("match " .. context.match_id .. " tick " .. tick)
    print("match " .. context.match_id .. " messages:\n" .. du.print_r(messages))
  end
--   if tick < 10 then
  if tick < 10 then
    return state
--   end
  end
end

--[[
+11 −0
Original line number Diff line number Diff line
@@ -22,8 +22,19 @@ local nk = require("nakama")

nk.run_once(function(context)
  assert(context.execution_mode, "run_once")

--   nk.match_create("match", {debug = true})
end)

nk.run_once(function(context)
  error("Should not be executed.")
end)

local function rpc_signal(context, payload)
  local matches = nk.match_list(1, true)
  if #matches < 1 then
    error("no matches")
  end
  return nk.match_signal(matches[1].match_id, payload)
end
nk.register_rpc(rpc_signal, "rpc_signal")