Lua Source Code Link?

Hello,

Is there any link to lua modules for nakama, nakama.matchmaker etc. As you know there is no intellisense on nakama lua modules. I’m on vs code. If there is a method, I want to know.

So I can’t understand which functions are available to use for a module. Or I can’t understand the parameters of a function until I dig deeper into the documentation.

I could not find Lua API reference or documentation that contains a full list of modules, classes, functions, properties, fields etc. Documentation has it partially on different links. But It is only a time-consuming experience. I want to know how everyone are developing on lua on top of the nakama modules.

Hey yusuf :slight_smile: I had a problem with that too…Lack of intellisense.
Then I started using a lua based editor called ZeroBrane.
Now with that editor, i could add support for intelisense at least for nakama, and as for project it self, it takes a while to make ti fully dynamically, but developer is friendly and you can ask him for guides :slight_smile:

To generate lua documentation you could take a look at:
https://heroiclabs.com/docs/nakama/server-framework/lua-runtime/function-reference/

https://github.com/heroiclabs/nakama/blob/master/server/runtime_lua.go

And the constructing it.

1 Like

@Eatos thanks for the response. ZeroBrane looks promising. But it is too much work to create a custom plugin or api on an editor. I did it for the vs code last year. But it took too much time and it is still impossible to cover all API. I scanned web pages and created it but in some point I noticed something. Some modules were missing in the official documentation. For example, even today if you check this code from the documentation you will see that it is impossible to guess the parameters of the context table or env table:

local function insert_user(context)
  -- This is to create a system ID that cannot be used via a client.
  local system_id = context.env["SYSTEM_ID"]

  nk.sql_exec([[
    INSERT INTO users (id, username)
    VALUES ($1, $2)
    ON CONFLICT (id) DO NOTHING
  ]], { system_id, "system_id" })
end

nk.run_once(insert_user)

let’s focus on the context. What are the other properties or fields of it? This link shows some details. But I don’t remember this page while I was developing the plugin last year.
https://heroiclabs.com/docs/nakama/server-framework/introduction/runtime-context/

And It is frustrating that jumping between missing and halfly organized web pages. So whatever, I don’t want to be the drama queen of the forum. I just need a page or source code link that contains all properties, functions, submodules of the nakama lua module. And submodules of Nakama module if there is any. Because there is no way to know directly without intellisense or a proper document, pdf, a total web page only contains table, function, field, property names etc.

Please help. :cry: :disappointed_relieved: :cry: :cry:

Right now I want to override the matchmaking process. For example, if a player sends some query parameters to match the other players, I want to loosen the parameters’ importance by time while waiting in the matchmaking pool. If we had a proper documentation, it would be finished in 30 minutes. But right now, I don’t even know that it is possible or not. This page says that it is possible:
https://heroiclabs.com/docs/nakama/concepts/multiplayer/matchmaker/#matchmaker-override
But Lua pages say nothing.

Well, It is not too much work to create api plugin for it :slight_smile: It will take you 4-5h if you automatize it with scrapper it can take you even less.
Now regarding context, it is pretty self explanatory what it contains from page you have linked o.O
Unless you are not understanding that you can always take a look at source code:
https://github.com/heroiclabs/nakama/blob/master/server/runtime_lua_context.go

Pretty much you can know all by looking at source code, if it is not written on documentation page, but you will need to understand go.
The Lua page in a lot of cases wont give you everything on the plate,there are no examples and for that kind of thing a trip to source code and a little bit of experimenting should be enough to make it.

Hello @yusuf, I understand your frustration for lack of intellisense but that’s just the nature of working with a dynamically typed language.

If you’d like to have proper intellisense you could use Go or the JS runtime with the TS type annotations we provide.

We do our best to have comprehensive documentation around all the APIs, if something’s incorrect or missing from the Lua function reference please report it.

As for the matchmaker override function, it’s currently only exposed in the Go runtime - this was a conscious decision given that it’s very performance sensitive and allowing it in Lua or JS could introduce significant overhead.

If you want to lax the matchmaker requirements over time, the recommended approach is for the client to submit another ticket to the matchmaker with a more permissive query.

Hope this helps.

I totally get you guys. I can check the source code. Yeah, I can think that. As a programmer, I have some brain cells. I’m aware of that you are trying to be helpful. But you are missing the point.

What is the purpose of the Nakama to be open source? As I understand, the main point is that spread Nakama and Heroiclabs as you can, so then you can sell other products and also the Nakama enterprise version, right? So what is the best way to do it? Giving a proper documentation sheet to developers. So they can read and understand the product easily. And, If they learn it easily, they will want to use it.

So can anybody tell me why don’t you have a full list of functions documentation of lua modules for Nakama? Why don’t you have a pdf or a basic 1998 model web page that contains all the information together in one place? So we can do a search on one page, and be sure about the capabilities while reading function and parameter names. I’ve been following the Nakama since it’s public days. And we never had a proper documentation. I believe that it is a lack of the management strategy issue.

Please check these web pages and inspire for the company decision in future, PLEASE.
https://www.raylib.com/cheatsheet/cheatsheet.html
https://ziglang.org/documentation/0.12.0/
https://www.geeksforgeeks.org/bootstrap-cheatsheet-a-basic-guide-to-bootstrap/?ref=lbp
https://zerotomastery.io/cheatsheets/react-cheat-sheet/
https://hackr.io/blog/cpp-cheat-sheet-pdf

if you check the web pages, you will see that everything is together. Easy to search, easy to see limits, easy to see capabilities.

Please don’t get me wrong. I’m a big fan of nakama even in this situation that we have. But I really don’t want to spend my time while I’m digging heroiclabs GitHub repos. I just need one cheat sheet for the product. Think like IKEA. Please :pray: