News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Judge multiple variables  (Read 955 times)

0 Members and 1 Guest are viewing this topic.

Offline mhdt

  • Jr. Member
  • **
  • Posts: 93
  • 中国!中国!中国!
    • View Profile
Judge multiple variables
« on: July 22, 2021, 11:29:35 PM »
Code: [Select]
if a ~= 1 and b ~= 2 and c ~= 3 thenI always write like this, but it is very troublesome. Is there an easier way?

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
Re: Judge multiple variables
« Reply #1 on: July 27, 2021, 12:04:35 AM »
不知道這樣有沒有用
I don't know it can work or not
Code: [Select]
local abc = {{a}, {b}, {c}}
ming = 1, table.getn(abc)
if abc[ming] ~= 3 then

Offline mhdt

  • Jr. Member
  • **
  • Posts: 93
  • 中国!中国!中国!
    • View Profile
Re: Judge multiple variables
« Reply #2 on: July 27, 2021, 04:31:22 AM »
It looks like
Code: [Select]
a ~= 3 or c ~= 3