diff options
author | chai <chaifix@163.com> | 2018-08-12 19:52:54 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-12 19:52:54 +0800 |
commit | 7b34bd98bb00796febd5351b9d2e75fd2c247432 (patch) | |
tree | dd2da6fa01094f864d8deb358d7f9a8fe1b32b1c /src/lua/embed/net.lua.h | |
parent | 5fe41eca99adf4bf0fb5832033a96f98b530d4f1 (diff) |
*update
Diffstat (limited to 'src/lua/embed/net.lua.h')
-rw-r--r-- | src/lua/embed/net.lua.h | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/lua/embed/net.lua.h b/src/lua/embed/net.lua.h index 3db9264..4d89dc7 100644 --- a/src/lua/embed/net.lua.h +++ b/src/lua/embed/net.lua.h @@ -1,70 +1,4 @@ /* net.lua */ static const char* net_lua = R"( jin.net = jin.net or {} - ---[[ -socketͨŵ -* INT 32 -* FLOAT 32 -* BOOL 32 -* STRING -- -STRINGжҽ磬0β -һЭ鶨ӣðЭͳһһluaļ --- s2c_package.lua -local INT = jin.net.dataType.INT -local FLOAT = jin.net.dataType.FLOAT -local BOOL = jin.net.dataType.BOOL -local STRING = jin.net.dataType.STRING -Skill = { - id = INT, - damage = FLOAT, - range = FLOAT, - description = STRING -} -ʱ -local data, size = jin.net.serialize(Message.Skill, message) -Socket:send(data, size) -յʱ -local data, size = Socket:receive() -local message = jin.net.deserialize(Message.Skill, data, size) -]] - -jin.net.dataType = { - INT = 1, - FLOAT = 2, - BOOL = 3, - STRING = 4 -} - -jin.net.dataSize = { - INT = 4, - FLOAT = 4, - BOOL = 4, - STRING = -1, -} - -jin.net.deserialize = function(prototype, data, size) - local message = {} - local i = 1 - for k, t in pairs(prototype) do - message[k] = data[i] - i = i + 1 - end - return message -end - -jin.net.serialize = function(prototype, message) - local data = "" - local size = 0 - for i, v in pairs(message) do - data, size = jin.bit.write(data, size, v) - end - return data, size -end - --- Э -jin.net.decode = function() - local s = jin.bit.grabstring(buffer, size) -end - )";
\ No newline at end of file |