Peer-to-peer networking library for Balatro
- Lua 90.1%
- Python 9.9%
| assets | ||
| lovely | ||
| src | ||
| srv | ||
| .luarc.json | ||
| .stylua.toml | ||
| LICENSE | ||
| manifest.json | ||
| README.md | ||
Seance
Peer-to-peer networking library for Balatro.
Installing
Seance requires Lovely. Once it is installed, place Seance (as source code or a zip archive) into your mods directory.
Usage
-- First, connect to the rendezvous server
local matchmaker = require('seance').matchmaker.listen()
-- Once `matchmaker:ready()` returns true, send `matchmaker.slug` to a peer so they can connect:
-- ```
-- local seance = require('seance').matchmaker.connect { slug = 'ABCDEF' }
-- ```
-- Once a peer tries to connect, this will return a seance (or `nil` in the meantime):
local seance = matchmaker:accept()
-- Refuse further connections.
matchmaker:close()
-- After this point, the connection is symmetric.
-- A seance multiplexes multiple datastreams over a UDP connection.
-- This acts like TCP:
local myCoolStream = seance:open('myCoolStream', { type = 'stream' })
myCoolStream:send('my cool data')
print(myCoolStream:recv())
-- This acts like UDP:
local myCoolerStream = seance:open('myCoolerStream', { type = 'messages' })
myCoolerStream:send('This data might get lost')
print(myCoolerStream:recv())
-- When you're done, close the connection and all of its children:
seance:close()