Revision Difference
net.Incoming#528204
<function name="Incoming" parent="net" type="libraryfunc">
<description>
<internal>You may be looking for <page>net.Receive</page>.</internal>
Function called by the engine to tell the lua state a message arrived.
</description>
<realm>Shared</realm>
<file line="17">lua/includes/extensions/net.lua</file>
<args>
<arg name="length" type="number">The message length, in bits.</arg>
<arg name="client" type="Player">The player that sent the message. This will be nil in the client state.</arg>
</args>
</function>⤶
⤶
<example>⤶
<description>Read all messages coming into the server that don't have valid Networked Strings</description>⤶
<code>⤶
function net.Incoming(len, client)⤶
local i = net.ReadHeader()⤶
local name = util.NetworkIDToString(i)⤶
⤶
local func = net.Receivers[name:lower()]⤶
⤶
if not(name) then⤶
print(string.format("Unpooled message name for net msg #%d", i))⤶
end⤶
⤶
if not(func) then⤶
print(string.format("No receiving function for '%s' (net msg #%d)", name, i))⤶
end⤶
⤶
len = len - 16⤶
⤶
func(len, client)⤶
⤶
end⤶
</code>⤶
⤶
⤶
</example></function>