Can somebody explain LAN

So recently I read this tutorial about setting up LAN:

However there are some areas i just do not understand.

The author didnt explain what the parameter ‘button’ was on his first two functions.
He made functions from it as if it were the module?
button.stopLooking = function()

Can somebody explain the minimum I need to create a LAN server (eventually close it), connect to it, and trade information?

It’s a Lua’s feature. In Lua functions are values, same as numbers or strings. This means functions can be passed around as arguments, assigned to variables etc.
In fact, this is equivalent code:

local function SayHi()
     print("Hi!")
end

and

local SayHi = function ()
     print("Hi!")
end

So assigning function to the variable can be useful, when you want to add some action you want to execute later.
Read more about functions in this chapter of PiL

Just a suggestion if you are looking towards outside LAN. You can use gamespark

https://docs.gamesparks.com/getting-started/creating-a-game/corona-setup.html

Hi,
The multiplayer guide provides basic modules that you can use in your application.
The key is to decide what to do in your application and how to use LAN communications.
I used what was read in the guide in my application - an online restaurant menu.
In principle, every table in the restaurant has a tablet from which the customer browses the menu and orders.
When the customer presses the order button of an item, the tablet sends the order to the waiter, on the kitchen or bar and on the server of the restaurant. It’s all about LAN. It’s easy for me, because from the router I assign a static IP address to each tablet on the tables, as well as to the waiters phones and a tablets in the kitchen, bar and restaurant server. The tablets on the tables are clients and the rest are in server mode.
If you have any questions, please contact me with a PM, I would be glad if I could hang on to something.

1 Like

I understand that both of those ways of defining functions are equivalent, i just don’t understand what ‘button’ actually refers to in his tutorial. Does it make sense that it is the button that calls the function when it is pressed?

Please read what Mark Steelman wrote in the tutorial :
“In this example, I’m passing in a reference to the button that the player pressed to activate the function. I do this because so the player can push it again and stop broadcasting. If you don’t want to do that, you don’t need the button reference.”

Here is a working example and library that i put together