Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

In Lua, you can compare two variables to see if they are equal using the == equality operator. For instance:

-- single = to assign values to variables
local Variable1 = "Fred"
local Variable2 = "Mary"
local Variable3 = "Fred"

if (Variable1 == Variable3) then
  trace("These variables are equal!")
end

Below are the comparison operators you can apply to compare variables:

== Equal to

~= Not equal to

< Less than

> Greater than

<= Lesser or equal to

>= Greater or equal to

See if statements for a simple example of applying these comparison operators.

  • No labels