Fix empty string parsing
This commit is contained in:
@ -3,6 +3,7 @@ local debug = false
|
||||
local CMH = {}
|
||||
local datacache = {}
|
||||
local delim = {"♠", "♥", "♚", "♛", "♜"}
|
||||
local emptyStr = "♝"
|
||||
local pck = {REQ = 1, DAT = 2}
|
||||
|
||||
-- HELPERS START
|
||||
@ -49,7 +50,12 @@ local function ParseMessage(str)
|
||||
-- Convert value to correct type
|
||||
for k, v in pairs(valTemp) do
|
||||
local varType = typeTemp[k]
|
||||
if(varType == 3) then -- Ints
|
||||
if(varType == 2) then -- Strings
|
||||
-- Special case for empty string parsing
|
||||
if(v == emptyStr) then
|
||||
v = ""
|
||||
end
|
||||
elseif(varType == 3) then -- Ints
|
||||
v = tonumber(v)
|
||||
elseif(varType == 4) then -- Tables
|
||||
v = Smallfolk.loads(v, #v)
|
||||
@ -72,6 +78,10 @@ local function ProcessVariables(reqId, ...)
|
||||
|
||||
for _, v in pairs(arg) do
|
||||
if(type(v) == "string") then
|
||||
-- Special case for empty string parsing
|
||||
if(#v == 0) then
|
||||
msg = msg .. emptyStr
|
||||
end
|
||||
msg = msg .. delim[2]
|
||||
elseif(type(v) == "number") then
|
||||
msg = msg .. delim[3]
|
||||
|
||||
Reference in New Issue
Block a user