Socket Injection
Networking in Love2D often uses socket (LuaSocket) or enet. Kaledis makes these available to your Luau code with typings.
Enabling Modules
Section titled “Enabling Modules”If you use detect_modules = false, explicitly enable them in kaledis.toml:
[project]modules = ["socket", "enet"]# ... other modulesUsage Example
Section titled “Usage Example”local udp = Socket.udp()udp:settimeout(0) -- Non-blockingudp:setsockname('*', 12345)
function love.update(dt) local data, msg_or_ip, port_or_nil = udp:receivefrom() if data then print("Received: ", data) endendTroubleshooting
Section titled “Troubleshooting”- Freezing: Networking calls are often blocking. Always use
:settimeout(0)for non-blocking operations in the game loop (love.update), or run networking in a separate thread. - “module ‘socket’ not found”: Ensure
kaledis.tomlincludes “socket” in the modules list if you are in manual mode.