The purpose of this library is to provide a safe channel for my addons to share data, because i noticed that some addons turn off lib group socket when they start.
This addon uses clockwork map to transfer bytes, so it shouldn't collide with other addons, because as far as im concerned, no one uses the clockwork map.
Functions:
function lib:RegisterSafeChannel(addonName, OnReciveData)
addonName: Addon registered (Might register your addon if you become my friend!)
OnReciveData(tag, b0, b1, b2, isLocalPlayerOwner): tag is the name of the sender, b0, b1 and b2 are the bytes, isLocalPlayerOwner is a boolean (true if player is the sender)
|
function lib:RegisterUnsafeChannel(channelNumber, OnReciveData)
channelNumber: Number between 0 and 255, if the number is already registered or being in use, chat will print an error
OnReciveData(tag, b0, b1, b2, isLocalPlayerOwner): tag is the name of the sender, b0, b1 and b2 are the bytes, isLocalPlayerOwner is a boolean (true if player is the sender)
|
function lib:UnregisterUnsafeChannel(channelNumber)
Stop listening channel number
|
function lib:UnregisterSafeChannel(addonName)
Stop listening registered addon name
|
function lib:SendSafeData(addonName, b0, b1, b2)
Send data using a registered addon, b0, b1, b2 are bytes to send
|
function lib:SendUnsafeData(channelNumber, b0, b1, b2)
Send data using a channel number, b0, b1, b2 are bytes to send
|
You can use the unsafe functions for your addons if you wish to use this library, but if you wish to use your addon's name to send data, and ensure that no one will use your channel's number, you may have to friend me.