mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-13 22:03:09 +00:00
nfqws2, zapret-lib: always treat blobs, % and # as string
This commit is contained in:
@@ -153,7 +153,7 @@ function apply_arg_prefix(desync)
|
||||
local c = string.sub(v,1,1)
|
||||
if c=='#' then
|
||||
local blb = blob(desync,string.sub(v,2))
|
||||
desync.arg[a] = (type(blb)=='string' or type(blb)=='table') and #blb or 0
|
||||
desync.arg[a] = tostring((type(blb)=='string' or type(blb)=='table') and #blb or 0)
|
||||
elseif c=='%' then
|
||||
desync.arg[a] = blob(desync,string.sub(v,2))
|
||||
elseif c=='\\' then
|
||||
@@ -545,6 +545,7 @@ function blob(desync, name, def)
|
||||
error("blob '"..name.."' unavailable")
|
||||
end
|
||||
end
|
||||
blob = tostring(blob)
|
||||
end
|
||||
return blob
|
||||
end
|
||||
|
||||
@@ -1248,6 +1248,7 @@ void lua_push_blob(lua_State *L, int idx_desync, const char *blob)
|
||||
lua_pop(L,1);
|
||||
lua_getglobal(L, blob);
|
||||
}
|
||||
lua_tostring(L,-1);
|
||||
}
|
||||
void lua_pushf_blob(lua_State *L, int idx_desync, const char *field, const char *blob)
|
||||
{
|
||||
@@ -1779,7 +1780,10 @@ void lua_pushf_args(lua_State *L, const struct str2_list_head *args, int idx_des
|
||||
lua_push_blob(L, idx_desync, val+1);
|
||||
lua_Integer len = lua_rawlen(L, -1);
|
||||
lua_pop(L,1);
|
||||
lua_pushf_int(L, var, len);
|
||||
lua_pushstring(L, var);
|
||||
lua_pushinteger(L, len);
|
||||
lua_tostring(L,-1); // force string type in arg
|
||||
lua_rawset(L,-3);
|
||||
}
|
||||
else
|
||||
lua_pushf_str(L, var, val);
|
||||
|
||||
Reference in New Issue
Block a user