-- Decompiled with the Synapse X Luau decompiler.


local v1 = {
	Name = "runif", 
	Aliases = {}, 
	Description = "Runs a given command string if a certain condition is met.", 
	Group = "DefaultUtil", 
	Args = { {
			Type = "conditionFunction", 
			Name = "Condition", 
			Description = "The condition function"
		}, {
			Type = "string", 
			Name = "Argument", 
			Description = "The argument to the condition function"
		}, {
			Type = "string", 
			Name = "Test against", 
			Description = "The text to test against."
		}, {
			Type = "string", 
			Name = "Command", 
			Description = "The command string to run if requirements are met. If omitted, return value from condition function is used.", 
			Optional = true
		} }
};
local u1 = {
	startsWith = function(p1, p2)
		if p1:sub(1, #p2) ~= p2 then
			return;
		end;
		return p1:sub(#p2 + 1);
	end
};
function v1.Run(p3, p4, p5, p6, p7)
	local v2 = u1[p4];
	if not v2 then
		return ("Condition %q is not valid."):format(p4);
	end;
	local v3 = v2(p6, p5);
	if not v3 then
		return "";
	end;
	return p3.Dispatcher:EvaluateAndRun(p3.Cmdr.Util.RunEmbeddedCommands(p3.Dispatcher, p7 and v3));
end;
return v1;
