Simplifying this breakdown of string args

I’m trying to set a number of conditions if a string is found in a table.

--[[
"me" is plr who triggered the command
"sd" is the name of the command
"120" is health it should be a number 
"parry" is a boolean that sets to a condition if found 
same with shield
]]
local args = ("me sd 2 120 parry shield")
local parry = false
local health:number? = 100
local shielded = false
for _,v in {args} do
	parry = if v:find("parry") then true else false
	shielded = if v:find("shield") then true else false
	if tonumber(args[4]) then
		health = args[4]
	end
end
print(parry,health,shielded)
1 Like
local function parseMessage(message)
    message = string.gsub(message, "%s+", " ") -- //Example: "<prefix>      command    arg" = "<prefix> command arg"

    local messageSplitArgs = string.split(message, " ")

    print(table.unpack(messageSplitArgs))
end