network: rpc_register
This commit is contained in:
parent
9b6ab097a7
commit
ff7767bfac
2 changed files with 21 additions and 0 deletions
20
vmf_source/scripts/mods/vmf/modules/core/network.lua
Normal file
20
vmf_source/scripts/mods/vmf/modules/core/network.lua
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
local vmf = get_mod("VMF")
|
||||||
|
|
||||||
|
local _RPC_CALLBACKS = {}
|
||||||
|
|
||||||
|
VMFMod.rpc_register = function (self, rpc_name, rpc_function)
|
||||||
|
|
||||||
|
if type(rpc_name) ~= "string" then
|
||||||
|
self:error("(rpc_register): rpc_name should be the string, not %s", type(rpc_name))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(rpc_function) ~= "function" then
|
||||||
|
self:error("(rpc_register): rpc_function should be the function, not %s", type(rpc_name))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
_RPC_CALLBACKS[self:get_name()] = _RPC_CALLBACKS[self:get_name()] or {}
|
||||||
|
|
||||||
|
_RPC_CALLBACKS[self:get_name()][rpc_name] = rpc_function
|
||||||
|
end
|
|
@ -15,6 +15,7 @@ return {
|
||||||
dofile("scripts/mods/vmf/modules/core/delayed_chat_messages")
|
dofile("scripts/mods/vmf/modules/core/delayed_chat_messages")
|
||||||
dofile("scripts/mods/vmf/modules/core/chat")
|
dofile("scripts/mods/vmf/modules/core/chat")
|
||||||
dofile("scripts/mods/vmf/modules/core/localization")
|
dofile("scripts/mods/vmf/modules/core/localization")
|
||||||
|
dofile("scripts/mods/vmf/modules/core/network")
|
||||||
dofile("scripts/mods/vmf/modules/gui/custom_textures")
|
dofile("scripts/mods/vmf/modules/gui/custom_textures")
|
||||||
dofile("scripts/mods/vmf/modules/gui/custom_menus")
|
dofile("scripts/mods/vmf/modules/gui/custom_menus")
|
||||||
dofile("scripts/mods/vmf/modules/gui/ui_scaling")
|
dofile("scripts/mods/vmf/modules/gui/ui_scaling")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue