# Lua server

**URL:** <https://forum.heroiclabs.com/t/lua-server/5071>\
**Category:** Local Setup\
**Tags:** server-framework, lua\
**Created:** [March 22, 2024, 9:04am UTC](https://forum.heroiclabs.com/t/lua-server/5071 "2024-03-22T09:04:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![F1ow](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@F1ow](https://forum.heroiclabs.com/u/F1ow)\
**Post date:** [March 22, 2024, 9:04am UTC](https://forum.heroiclabs.com/t/lua-server/5071/1 "2024-03-22T09:04:32Z")

</div>

I wanted to create a game with a server in lua. I found an example of a server script on github - [game-xoxo-nakama-server/main.lua at main · defold/game-xoxo-nakama-server · GitHub](https://github.com/defold/game-xoxo-nakama-server/blob/main/main.lua) Here the function is -nk.run\_once(function(ctx)  
local now = os.time()  
log(“Backend loaded at %d”, now)  
nk.register\_matchmaker\_matched(make match)  
end)  
apparently creates a separate server instance? I don’t fully understand.  
My matches are created and players connect via nakama. If I’m going to use the server only to store variables for both players and pass them to certain players upon request. I will also need to make a move counter with a timer on the server.  
In the same github file tictactoe\_match.ua the whole logic of creating a match is described. Will I need to do something similar too? And in general, how are the player’s requests to the lua server going? Please help me!

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 22, 2024, 11:33am UTC](https://forum.heroiclabs.com/t/lua-server/5071/2 "2024-03-22T11:33:44Z")

</div>

Hello @F1ow, have you had a look at our docs regarding [authoritative matches](https://heroiclabs.com/docs/nakama/concepts/multiplayer/authoritative/)?

---

<div class="post-metadata">

**Author:** ![F1ow](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@F1ow](https://forum.heroiclabs.com/u/F1ow)\
**Post date:** [March 22, 2024, 11:59am UTC](https://forum.heroiclabs.com/t/lua-server/5071/3 "2024-03-22T11:59:25Z")

</div>

wow, i check yhis. Thank you
