Skip to main content

Link

Extremely simple networking library that allows you to create shared modules for remotes that are the same between both the client and server.

--// Shared
local Link = require(ReplicatedStorage.Packages.Link)

local Remotes = {
    MoneyNamespace = {
        Get = Link.fn(),
    },
}

return Remotes

--// Server
local Remotes = require(ReplicatedStorage.Remotes)

Remotes.MoneyNamespace.Get.OnServerInvoke = function()
    return 42
end

--// Client
local Remotes = require(ReplicatedStorage.Remotes)

local money = Remotes.MoneyNamespace.Get:InvokeServer()
print('I have $' .. tostring(money))

Functions

event

Link.event() β†’Β RemoteEvent

If being called on the server, it will create a new RemoteEvent, but if being called on the client, it will instead find the server created RemoteEvent by the line the function was called at.

Since Link is meant to be used in shared modules, the line is guaranteed to be the same between both environments, thus making this method possible.

fn

Link.fn() β†’Β RemoteFunction

Similar to Link.event, but returns a RemoteFunction instead.

Show raw api
{
    "functions": [
        {
            "name": "event",
            "desc": "If being called on the server, it will create a new RemoteEvent, but if being called on the client, it will instead find the server created\nRemoteEvent by the line the function was called at.\n\nSince Link is meant to be used in shared modules, the line is guaranteed to be the same between both environments, thus making this method possible.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RemoteEvent"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 45,
                "path": "src/init.lua"
            }
        },
        {
            "name": "fn",
            "desc": "Similar to [Link.event], but returns a RemoteFunction instead.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RemoteFunction"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 53,
                "path": "src/init.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Link",
    "desc": "Extremely simple networking library that allows you to create shared modules for remotes that are the same between both the client and server.\n\n```lua\n--// Shared\nlocal Link = require(ReplicatedStorage.Packages.Link)\n\nlocal Remotes = {\n    MoneyNamespace = {\n        Get = Link.fn(),\n    },\n}\n\nreturn Remotes\n\n--// Server\nlocal Remotes = require(ReplicatedStorage.Remotes)\n\nRemotes.MoneyNamespace.Get.OnServerInvoke = function()\n    return 42\nend\n\n--// Client\nlocal Remotes = require(ReplicatedStorage.Remotes)\n\nlocal money = Remotes.MoneyNamespace.Get:InvokeServer()\nprint('I have $' .. tostring(money))\n```",
    "source": {
        "line": 34,
        "path": "src/init.lua"
    }
}