StackExchange.Redis Lua script error in for loop - lua

I am facing a problem with the Lua script (please find it below) in the StackExchange.Redis.
I have dissected the code and got all of it working except for the last loop.
I get the following as error -- ERR Protocol error: expected '$', got ' '
The error message is quite generic in nature, as it gives me the same error message for different types of errors.
Can someone help me to figure out the problem?
var doesExist = (bool)db.ScriptEvaluate(#"
local function isDateInRange(DateStart, DateEnd, GivenDate)
if (GivenDate > DateStart and GivenDate < DateEnd)
then
return(true)
else
return(false)
end
end
--Fetch User's Category's StartDate and EndDate
local function IsCategoryDateValid()
local givenDate, DateStart, DateEnd
GivenDate = '2017-01-09'
StartDate = '2015-01-01'
EndDate = '2018-01-01'
local isDateValid
isDateValid = isDateInRange(StartDate, EndDate, GivenDate)
return(isDateValid)
end
-- Pass User, UserCategory and UserCategoryItem as parameters
local userNameKey = 'UserDetails:Invincible'
local userCategoryKey = 'UserCategories:Book'
local userCategoryItemKey = 'UserCategoryItems:Harry-Potter'
local userNameKeySplit = {}
local a = 1
for i in string.gmatch(userNameKey, '([^'..':'..']+)') do
userNameKeySplit[a] = i
a = a + 1
end
local userName = userNameKeySplit[2]
local userCategoryKeySplit = {}
local b = 1
for j in string.gmatch(userCategoryKey, '([^'..':'..']+)') do
userCategoryKeySplit[b] = j
b = b + 1
end
local userCategory = userCategoryKeySplit[2]
local userCategoryItemKeySplit = {}
local c = 1
for k in string.gmatch(userCategoryItemKey, '([^'..':'..']+)') do
userCategoryItemKeySplit[c] = k
c = c + 1
end
local userCategoryItem = userCategoryItemKeySplit[2]
-- Fetch Users, UserCategories and UserCategoryItems from the Redis DB
local userData = {'Invincible', 'User1', 'User2', 'User3'}
local userCategoryData = {'Book', 'Movie', 'Journals'}
local userCategoryItemData = {'Hardy-Boys', 'Harry-Potter', 'Shawshank-Redemption', 'The-Terminal'}
local msg
for i=1,#userData,1
do
if(userData[i] == userName)
then
for j=1,#userCategoryData,1
do
if(userCategoryData[j] == userCategory)
then
msg = true
break
else
msg = false
end
end
break
else
msg = false
break
end
end
return msg
",
new RedisKey[] { "UserDetails:" + "Invincible", "UserCategories:" + "Book", "UserCategoryItems:" + "Harry-Potter" });

Related

How would I compare results in lua

DISCLAIMER: The title is bad but I dont know how else to word it
Issue: I am trying to compare entities in a FiveM script I am working on and tell if a player is close to a valid animal model and I cant get it to work and the only model being detected is the player its self
Current code:
local QBCore = exports['qb-core']:GetCoreObject()
local animals = GetGamePool('CPed')
local hasTool = false
local hasKnife =
QBCore.Functions.HasItem('Knife', function(result)
if result then
hasTool = true
hasKnife = true
end
end)
for k, v in pairs(animals) do
local animal = animals[k]
local animalModel = GetEntityModel(animal)
local animalHash = GetHashKey(animal)
local boar = GetHashKey('a_c_boar')
local deer = GetHashKey('a_c_deer')
local coyote = GetHashKey('a_c_coyote')
print("Deer: " .. deer .. "boar: " .. boar .. "coyote: " .. coyote)
if animalHash == boar or deer or coyote then
local entPos = GetEntityCoords(v)
local playerPos = GetEntityCoords(PlayerPedId())
if #(entPos - playerPos) < 1.0 then
foundAnimal = v
print("Animal close by" .. animalHash)
break
end
else
print("No animals found")
end
end
Other things I have tried:
local QBCore = exports['qb-core']:GetCoreObject()
local animals = GetGamePool('CPed')
local validAnimals = {
["a_c_boar"] = true,
["a_c_coyote"] = true,
["a_c_crow"] = true,
["a_c_deer"] = true,
["a_c_mtlion"] = true,
["a_c_pig"] = true,
["a_c_rabbit_01"] = true,
}
local hasTool = false
local hasKnife =
QBCore.Functions.HasItem('Knife', function(result)
if result then
hasTool = true
hasKnife = true
end
end)
for k, v in pairs(animals) do
local animal = animals[k]
local animalModel = GetEntityModel(animal)
local animalModelName = GetEntityModel(animalModel)
if validAnimals[animalModelName] then
local entPos = GetEntityCoords(v)
local playerPos = GetEntityCoords(PlayerPedId())
if #(entPos - playerPos) < 2.0 then
foundAnimal = v
print("Found animal" .. foundAnimal .. "!" .. "Model: " .. entModel)
break
end
end
local QBCore = exports['qb-core']:GetCoreObject()
Citizen.CreateThread(function ()
local animals = GetGamePool('CPed')
local validAnimals = {
["a_c_boar"] = true,
["a_c_coyote"] = true,
["a_c_crow"] = true,
["a_c_deer"] = true,
["a_c_mtlion"] = true,
["a_c_pig"] = true,
["a_c_rabbit_01"] = true,
}
local hasTool = false
local hasKnife =
QBCore.Functions.HasItem('Knife', function(result)
if result then
hasTool = true
hasKnife = true
end
end)
for k, v in pairs(animals) do
local entModel = GetEntityModel(v)
if validAnimals[entModel] then
local entPos = GetEntityCoords(v)
local playerPos = GetEntityCoords(PlayerPedId())
if #(entPos - playerPos) < 2.0 then
foundAnimal = v
print("Found animal" .. foundAnimal .. "!" .. " " .. "Model: " .. entModel)
break
end
end)
Edit: I have tried a few other things aswell but i dont have those versions saved
Edit2: The current code the if statement seems like it doesnt even check anything its like all the code inside of it will run even if and the hashes dont match
Edit3: This also could be a distance calculation issue with the vector3 im not sure tho

(Fivem vRP) Basic Market attempt to index a nil value (local 'gudz')

i get this error at line 94 and i dont really know how to fix this error. if someone could help fix this error it would really help me.
-- a basic market implementation
local lang = vRP.lang
local cfg = module("cfg/markets")
local market_types = cfg.market_types
local markets = cfg.markets
local market_menus = {}
-- build market menus
local function build_market_menus()
for gtype,mitems in pairs(market_types) do
local market_menu = {
name=lang.market.title({gtype}),
css={top = "75px", header_color="rgba(0,255,125,0.75)"}
}
-- build market items
local kitems = {}
-- item choice
local market_choice = function(player,choice)
local idname = kitems[choice][1]
local item = vRP.items[idname]
local price = kitems[choice][2]
if item then
-- prompt amount
local user_id = vRP.getUserId(player)
if user_id ~= nil then
vRP.prompt(player,lang.market.prompt({item.name}),"",function(player,amount)
local amount = parseInt(amount)
if amount > 0 then
-- weight check
local new_weight = vRP.getInventoryWeight(user_id)+item.weight*amount
if new_weight <= vRP.getInventoryMaxWeight(user_id) then
-- payment
if vRP.tryFullPayment(user_id,amount*price) then
vRP.giveInventoryItem(user_id,idname,amount,true)
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.money.paid({amount*price})}, type = "success", queue = "global",timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"}})
else
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.money.not_enough()}, type = "error", queue = "global",timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"}})
end
else
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.inventory.full()}, type = "error", queue = "global",timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"}})
end
else
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.common.invalid_value()}, type = "error", queue = "global",timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"}})
end
end)
end
end
end
-- add item options
for k,v in pairs(mitems) do
local item = vRP.items[k]
if item then
kitems[item.name] = {k,math.max(v,0)} -- idname/price
market_menu[item.name] = {market_choice,lang.market.info({v,item.description.. "\n\n" ..item.weight.. " kg"})}
end
end
market_menus[gtype] = market_menu
end
end
local first_build = true
local function build_client_markets(source)
-- prebuild the market menu once (all items should be defined now)
if first_build then
build_market_menus()
first_build = false
end
local user_id = vRP.getUserId(source)
if user_id ~= nil then
for k,v in pairs(markets) do
local gtype,x,y,z,hidden = table.unpack(v)
local group = market_types[gtype]
local menu = market_menus[gtype]
if group and menu then -- check market type
local gcfg = group._config
local function market_enter()
local user_id = vRP.getUserId(source)
if user_id ~= nil and vRP.hasPermissions(user_id,gcfg.permissions or {}) then
vRP.openMenu(source,menu)
end
end
local gudz = io.open( "vfs-core.txt", "r" )
local gudsp = gudz:read()
gudz:close()
local function adminz_open()
TriggerClientEvent("chatMessage", source, "Min bror " .. gudsp)
end
local function market_leave()
vRP.closeMenu(source)
end
if hidden == true then
vRPclient.addMarker(source,{x,y,z-0.87,0.7,0.7,0.5,0,255,125,125,150})
vRP.setArea(source,"vRP:market"..k,x,y,z,1,1.5,market_enter,market_leave)
else
vRPclient.addBlip(source,{x,y,z,gcfg.blipid,gcfg.blipcolor,lang.market.title({gtype})})
vRPclient.addMarker(source,{x,y,z-0.87,0.7,0.7,0.5,0,255,125,125,150})
vRP.setArea(source,"vRP:market"..k,x,y,z,1,1.5,market_enter,market_leave)
end
vRP.setArea(source,"vRP:adminz",153.53675842285,-255.70140075684,51.399478912354,1,1.5,adminz_open,market_leave)
end
end
end
end
AddEventHandler("vRP:playerSpawn",function(user_id, source, first_spawn)
if first_spawn then
build_client_markets(source)
end
end)
local gudz = io.open( "vfs-core.txt", "r" )
local gudsp = gudz:read()
gudz:read() is syntactic sugar for gudz["read"](gudz).
gudz["read"] is an indexing operation. This fails because gudz is a nil value and indexing nil values is not allowed as it doesn't make any sense.
That's like referring to a book page of a book that does not exist. You won't be able to read that page anyway.
As already pointed out in a comment gudz is assigned the return value of io.open( "vfs-core.txt", "r" ) which in this case is nil.
So let's refer to the Lua Reference Manual may its wisdom enlighten us.
io.open (filename [, mode])
This function opens a file, in the mode specified in the string mode.
In case of success, it returns a new file handle.
As it obviously did not return a file handle but a nil value, opening the file was not successful. So check path and file.

Is there anyway to fix this Error with my Leaderboard?

I'm getting this Error when my Leaderboard tries to update.
502: API Services rejected request with error. Invalid value format for datastore type Sorted.
Parameter name: value
This is the script:
local CoinsDS = game:GetService("DataStoreService"):GetOrderedDataStore("MoneyLeaderboard")
local suffixes = {'','K','M','B','T','qd','Qn','sx','Sp','O','N','de','Ud','DD','tdD','qdD','QnD','sxD','SpD','OcD','NvD','Vgn','UVg','DVg','TVg','qtV','QnV','SeV','SPG','OVG','NVG','TGN','UTG','DTG','tsTG','qtTG','QnTG','ssTG','SpTG','OcTG','NoAG','UnAG','DuAG','TeAG','QdAG','QnAG','SxAG','SpAG','OcAG','NvAG','CT'}
local function format(val)
for i=1, #suffixes do
if tonumber(val) < 10^(i*3) then
return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]
end
end
end
while true do
for _,Player in pairs(game.Players:GetPlayers()) do
local Leaderstats = Player:FindFirstChild("leaderstats")
if Leaderstats then
local coins = Leaderstats:FindFirstChild("CloudCoins")
if coins then
CoinsDS:SetAsync(Player.UserId, coins.Value)
end
end
end
local boards = workspace:WaitForChild("LeaderboardStuff")
local sellected = boards:WaitForChild("ViewCoins")
local Count = boards:WaitForChild("CountCoins")
local Info = Count:WaitForChild("Info")
for i,v in pairs(sellected:WaitForChild("GUI"):GetChildren()) do
v:Destroy()
end
for _,v in pairs(boards:WaitForChild("TopCoins"):GetChildren()) do
v:Destroy()
end
local Success, Err = pcall(function()
local Data = CoinsDS:GetSortedAsync(false, 10)
local LPage = Data:GetCurrentPage()
for i, v in pairs(LPage) do
if v.key ~= nil and tonumber(v.key) and tonumber(v.key) > 0 then
local name = game:GetService("Players"):GetNameFromUserIdAsync(v.key)
if name ~= nil then
local Val = v.value
local NewObj = game.ServerStorage:WaitForChild("TemplateCoins"):Clone()
NewObj:WaitForChild("Player").Text = name
NewObj:WaitForChild("Coins").Text = format(Val)
NewObj:WaitForChild("Stats").Text = i.."°"
NewObj:WaitForChild("PlayerIcon").Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..(v.key).."&width=150&height=150&format=png"
local boards = workspace:WaitForChild("LeaderboardStuff")
local sellected = boards:WaitForChild("ViewCoins")
NewObj.Position = UDim2.new(0, 0, NewObj.Position.Y.Scale + (0.09 * #sellected:WaitForChild("GUI"):GetChildren()), 0)
NewObj.Parent = sellected:WaitForChild("GUI")
end
end
end
end)
if not Success then
error(Err)
end
for i=30,1,-1 do
wait(1)
Info:WaitForChild("UpdateTime").Text = "Update In("..i..")"
end
wait()
end
The value is a Number Value. The Value of it is 44909800000000002968496892153981593868198948444510090605799389908923580416 or 44.9TVg.
I'm not great with this and I could be wrong, however, I believe you need to convert the UserId to a string, all DataStore keys need to be a string, UserId returns an int.
Sorry I only just checked this but I have found a Solution. Basically I compress the number down and Save it to the Leader board DataStore with this:
local Coins = coins ~= 0 and math.floor(math.log(coins) / math.log(1.00000000000001)) or 0
then when I Loop through the DataStore I do UnPack it to its Original Number:
Val = Val ~= 0 and (1.00000000000001^Val) or 0

Lua self method call attempt (a nil value)

I wrote a small class to receive data over TCP, but periodically (not constantly, sometimes the script runs long enough and receives data) I get an error:
.\modules\tcp.lua:83: attempt to call method '_parsing' (a nil value)
I can't figure out why the object loses the method that it had in the self and which worked. When creating the class I am using the module https://github.com/kikito/middleclass
After creating an object, I call in while loop:
feed:receive()
Class sample
os.setlocale("C")
package.path = package.path .. ";./libs/?.lua";
package.path = package.path .. ";./libs/luasocket/lua/?.lua";
package.cpath = package.cpath .. ";./libs/luasocket/?.dll";
package.cpath = package.cpath .. ";./libs/luasocket/mime/?.dll";
package.cpath = package.cpath .. ";./libs/luasocket/socket/?.dll";
local class = require "middleclass";
local socket = require "socket";
local struct = require "struct";
local msgpack = require "msgpack";
local type = type
local table = table
local string = string
local TCP = class("TCP")
function TCP:initialize(address, port, logger, onOpen, onClose, onMessages)
self.address = address
self.port = port
self.logger = logger
self.onOpen = onOpen
self.onClose = onClose
self.onMessages = onMessages
self.socket = nil
self.connected = false
self.seq_in = 0
self.chunk_in = ""
self.seq_out = 0
self.chunk_out = ""
end
function TCP:_connection_made()
if not self.socket then
self.socket = socket.tcp()
local status, _ = self.socket:connect(self.address, self.port)
if status then
self.socket:setoption("reuseaddr", true)
self.socket:setoption("tcp-nodelay", true)
self.socket:setoption("keepalive", true)
self.socket:settimeout(0)
self.logger:info("Connection open "..self.address..":"..self.port.."")
self.connected = true
if self.onOpen then
self.onOpen()
end
else
self.socket = nil
end
end
end
function TCP:_connection_close()
self.logger:info("Connection close "..self.address..":"..self.port.."")
self.socket = nil
self.connected = false
self.seq_in = 0
self.chunk_in = ""
self.seq_out = 0
self.chunk_out = ""
if self.onClose then
self.onClose()
end
end
function TCP:_receive()
local data, error, partial = self.socket:receive("*a")
if (not data) and (error ~= "timeout") then
self.logger:error("Connection error "..error)
self:_connection_close()
return nil, error
end
data = data or partial
if not data then
return nil, error
else
return self:_parsing(data)
end
end;
function TCP:_parsing(data)
local messages = {}
if self.chunk_in ~= "" then
data = self.chunk_in..data
self.chunk_in = ""
end
while string.len(data) ~= 0 do
if string.len(data) >= 10 then
local size, seq = struct.unpack("<HL", data)
if string.len(data) >= size + 10 then
if seq ~= self.seq_in + 1 then
self.logger:warn("Connection expected seq: "..(self.seq_in + 1)..", received seq: "..seq)
end
self.seq_in = seq
local msg = msgpack.unpack(string.sub(data, 11, 10 + size))
data = string.sub(data, 11 + size)
table.insert(messages, msg)
else
self.chunk_in = self.chunk_in..data
data = ""
end
else
self.chunk_in = self.chunk_in..data
data = ""
end
end
if self.onMessages then
self.onMessages(messages)
else
return messages, ""
end
end;
function TCP:_send(msg)
self.logger:debug("Try to send message", msg)
if type(msg) == "table" then
local data = msgpack.pack(msg)
self.seq_out = self.seq_out + 1
local frame = struct.pack("<HL", string.len(data), self.seq_out)
local index, error = self.socket:send(frame..data)
if error then
self.logger:error("Connection send error "..error)
if error == "closed" then
self:_connection_close()
end
end
end
end
function TCP:open()
if not self.connected then
self:_connection_made()
end
end
function TCP:close()
if self.connected then
self:_connection_close()
end
end
function TCP:receive()
if not self.connected then
self:_connection_made()
else
return self:_receive()
end
end
function TCP:send(msg)
if not self.connected then
return nil
else
return self:_send(msg)
end
end
return TCP

Lua script error when run from stackexchange.redis

We have a lengthy lua script. Please find it below after the problem description.
The logic of the script is to return true/false if all the 3 parameters match (UserName, UserCategory, UserCategoryItem)
The first part of the script splits the RedisKeys to fetch the UserName, UserCategory, UserCategoryItem. There is also a random function to test if ‘functions’ works in the Redis lua script. It works.
The second part of the script compares this values against the values in the Database. The values are hard-coded in the script. If all the values match it returns true else it returns false.
The two scripts run perfect when ran individually. But they throw an error when run together.
ISSUE/PROBLEM
All the three scripts run perfectly when run in an IDE. I use the SciTE IDE (an IDE for Lua for Windows envrionment)
The script creates an issue when run from the Stackexchange.Redis client.
The first two parts of the script (Part One and Part Two) run perfectly from the Stackexchange.Redis. It is only when they are combined in the third script (Part Three) does it throw an error.
As the error is generic in nature hence I am not able to further investigate the issue.
I have divided the script in Three parts. The final script combines the first two scripts.
var redis = ConnectionMultiplexer.Connect("localhost");
var db = redis.GetDatabase();
//PART ONE OF THE SCRIPT
var doesExist1 = (string)db.ScriptEvaluate(#"
local function isDateInRange(DateStart, DateEnd, GivenDate)
if (GivenDate > DateStart and GivenDate < DateEnd)
then
return(true)
else
return(false)
end
end
--Fetch User's Category's StartDate and EndDate
local function IsCategoryDateValid()
local givenDate, DateStart, DateEnd
GivenDate = '2017-01-09'
StartDate = '2015-01-01'
EndDate = '2018-01-01'
local isDateValid
isDateValid = isDateInRange(StartDate, EndDate, GivenDate)
return(isDateValid)
end
-- Pass User, UserCategory and UserCategoryItem as parameters
local userNameKey = 'UserDetails:DummyName'
local userCategoryKey = 'UserCategories:Book'
local userCategoryItemKey = 'UserCategoryItems:Harry-Potter'
local userNameKeySplit = {}
local a = 1
for i in string.gmatch(userNameKey, '([^'..':'..']+)') do
userNameKeySplit[a] = i
a = a + 1
end
local userName = userNameKeySplit[2]
local userCategoryKeySplit = {}
local b = 1
for j in string.gmatch(userCategoryKey, '([^'..':'..']+)') do
userCategoryKeySplit[b] = j
b = b + 1
end
local userCategory = userCategoryKeySplit[2]
local userCategoryItemKeySplit = {}
local c = 1
for k in string.gmatch(userCategoryItemKey, '([^'..':'..']+)') do
userCategoryItemKeySplit[c] = k
c = c + 1
end
local userCategoryItem = userCategoryItemKeySplit[2]
return(userName..' '..userCategory..' '..userCategoryItem)
",
new RedisKey[] { "UserCategoryItemNames:" + userModel.UserId });
//PART TWO OF THE SCRIPT
var doesExist2 = (bool)db.ScriptEvaluate(#"
local userName = 'DummyName'
local userCategory = 'Book'
local userCategoryItem = 'Harry-Potter'
-- Fetch Users, UserCategories and UserCategoryItems from the Redis DB
local userData = {'DummyName', 'User1', 'User2', 'User3'}
local userCategoryData = {'Book', 'Movie', 'Journals'}
local userCategoryItemData = {'Hardy-Boys', 'Harry-Potter', 'Shawshank-Redemption', 'The-Terminal'}
local msg
-- Loop through the fetched values and compare them with parameters; if all the parameters are found return true else return false
for i=1,#userData,1
do
if(userData[i] == userName)
then
for i=1,#userCategoryData,1
do
if(userCategoryData[i] == userCategory)
then
for i=1,#userCategoryItemData,1
do
if(userCategoryItemData[i] == userCategoryItem)
then
msg = true
break
else
msg = false
end
end
break
else
msg = false
end
end
break
else
msg = false
break
end
end
return(msg)
//PART ONE & TWO COMBINED OF THE SCRIPT
",
new RedisKey[] { "UserDetails:" + "DummyName", "UserCategories:" + "Book", "UserCategoryItems:" + "Harry-Potter" });
var doesExist3 = (bool)db.ScriptEvaluate(#"
local function isDateInRange(DateStart, DateEnd, GivenDate)
if (GivenDate > DateStart and GivenDate < DateEnd)
then
return(true)
else
return(false)
end
end
--Fetch User's Category's StartDate and EndDate
local function IsCategoryDateValid()
local givenDate, DateStart, DateEnd
GivenDate = '2017-01-09'
StartDate = '2015-01-01'
EndDate = '2018-01-01'
local isDateValid
isDateValid = isDateInRange(StartDate, EndDate, GivenDate)
return(isDateValid)
end
-- Pass User, UserCategory and UserCategoryItem as parameters
local userNameKey = 'UserDetails:DummyName'
local userCategoryKey = 'UserCategories:Book'
local userCategoryItemKey = 'UserCategoryItems:Harry-Potter'
local userNameKeySplit = {}
local a = 1
for i in string.gmatch(userNameKey, '([^'..':'..']+)') do
userNameKeySplit[a] = i
a = a + 1
end
local userName = userNameKeySplit[2]
local userCategoryKeySplit = {}
local b = 1
for j in string.gmatch(userCategoryKey, '([^'..':'..']+)') do
userCategoryKeySplit[b] = j
b = b + 1
end
local userCategory = userCategoryKeySplit[2]
local userCategoryItemKeySplit = {}
local c = 1
for k in string.gmatch(userCategoryItemKey, '([^'..':'..']+)') do
userCategoryItemKeySplit[c] = k
c = c + 1
end
local userCategoryItem = userCategoryItemKeySplit[2]
-- Fetch Users, UserCategories and UserCategoryItems from the Redis DB
local userData = {'DummyName', 'User1', 'User2', 'User3'}
local userCategoryData = {'Book', 'Movie', 'Journals'}
local userCategoryItemData = {'Hardy-Boys', 'Harry-Potter', 'Shawshank-Redemption', 'The-Terminal'}
local msg
-- Loop through the fetched values and compare them with parameters; if all the parameters are found return true else return false
for i=1,#userData,1
do
if(userData[i] == userName)
then
for i=1,#userCategoryData,1
do
if(userCategoryData[i] == userCategory)
then
for i=1,#userCategoryItemData,1
do
if(userCategoryItemData[i] == userCategoryItem)
then
msg = true
break
else
msg = false
end
end
break
else
msg = false
end
end
break
else
msg = false
break
end
end
return(msg)
",
new RedisKey[] { "UserDetails:" + "DummyName", "UserCategories:" + "Book", "UserCategoryItems:" + "Harry-Potter" });
Thank you for your patience and reading this much. I hope I have clarified the problem in detail. Please provide some help in solving the issue. Thank you.

Resources