Assert argument count mismatch warning

Hello!

Basically the title. Whenever I use assert, it always gives me a warning that says that there is an argument mismatch and I haven’t been able to silence it. Am I using it wrong or is it just something visual and I am not using it wrong?

Example:

As of now it’s a bug with the assert function that hasn’t been fixed yet where it thinks it needs 1 argument but it requires 2, you’re using it correctly. If you don’t want the warning, you can use an if statement for the time being until word goes about that it’s fixed

if not true then error("string lol") end
2 Likes

wat is???

assert()-- ???

It’s a function that basically displays a custom error if the given condition is false

assert(x > y, "Y is greater or equal to X")

If y was greater or equal to x it would error with the text given in argument 2

2 Likes

so this is

assert(math.random(1, 2)== 1, "AMOGN US")

is the same as this???

if math.Random(1, 2) == 1, then
 print("AMOGN US")
end

if you want it to be equal also do

assert(x => y, "Y is greater or equal to X")

No, it would be the same as

if math.random(1, 2) == 2, then
 error("AMOGN US")
end

or

if not (math.Random(1, 2) == 1) then
 error("AMOGN US")
end

Also it’s better to move this into our messages since this is a completed post

1 Like