(因安全问题已存档,我早就该听劝的)
一个允许你打开并使用 TCP 套接字的 Aviator 插件。
如果模组导致游戏崩溃或未按预期工作,请通过 Discord 联系我 ktzukii。
(请在消息中附上日志,否则你会得到“无效,请阅读描述”的回复)
文档:
SocketAPI (全局 socket)
如果运行化身(你的脚本和模型)的客户端(游戏)不是主机(例如,你的游戏会返回一个 LuaSocket 实例,而其他客户端将返回 nil),这些函数 WILL 返回 nil。
因此,请在你的套接字脚本中添加主机检查,否则你的化身会在其他客户端上出错,并造成不必要的麻烦和困惑。
SocketAPI:newSocket(String host, Number port) -> LuaSocket
打开一个新的套接字,将在日志中打印错误或抛出虚拟机错误。
SocketAPI:newWebsocket(String host, Number port) -> LuaWebsocket
打开一个新的 WebSocket,将在日志中打印错误或抛出虚拟机错误。
SocketAPI:closeAllSocket( -> nil)
关闭当前化身上的所有套接字
SocketAPI:closeAllWebsocket() -> nil
关闭当前化身上的所有 WebSocket
SocketAPI:closeAll() -> nil
关闭当前化身上的所有套接字和/或 WebSocket
LuaSockets
LuaSocket:hasData() -> boolean
返回是否有数据可供 recv 接收
LuaSocket:recv() -> string
返回任何发送的数据
LuaSocket:close() -> nil
干净地关闭 LuaSocket,而不是以奇怪的方式断开连接。
LuaSocket:isClosed() -> boolean
返回 LuaSocket 是否已关闭。
LuaSocket:isConnected() -> boolean
返回 LuaSocket 是否仍然打开。
示例:
已移除:我的示例太烂了 :3
我会尝试在 Github WIKI 上添加一些示例,但不保证。
(archived for security concerns i should have listened to a long time ago)
A figura addon that allows you to open and use TCP sockets.
You can contact me at ktzukii on Discord if the mod crashes your game, or doesn't work as intended.
(please attach the logs on the message, if not you're getting a "invalid, read description")
Documentation:
SocketAPI (global socket)
These functions WILL return nil if the client (game) running the avatar (your scripts and model) is not the host (eg. your game will return a LuaSocket instance, others will return nil.)
So please add host checks on your socket scripts, otherwise your avatar will error on other clients, and will cause unneccesary trouble and confusion.
SocketAPI:newSocket(String host, Number port) -> LuaSocket
Opens a new socket, will print errors in log or throw vm error.
SocketAPI:newWebsocket(String host, Number port) -> LuaWebsocket
Opens a new websocket, will print errors in log or throw vm error.
SocketAPI:closeAllSocket( -> nil)
Close all sockets on the current avatar
SocketAPI:closeAllWebsocket() -> nil
Close all websockets on the current avatar
SocketAPI:closeAll() -> nil
Closes all sockets and/or websockets on the current avatar
LuaSockets
LuaSocket:hasData() -> boolean
Returns whether there's data to be recv'd or not
LuaSocket:recv() -> string
Returns any data that was sent
LuaSocket:close() -> nil
Closes the LuaSocket cleanly instead of disconnecting weirdly.
LuaSocket:isClosed() -> boolean
Returns whether the LuaSocket is closed or not.
LuaSocket:isConnected() -> boolean
Returns whether the LuaSocket is still open or not.
Examples:
REMOVED: My examples suck :3
I'll try to add some examples on the Github WIKI, but no promises.
评论 0
登录后参与评分
还没有评论,来抢沙发吧