LINUX.ORG.RU

История изменений

Исправление Forum0888, (текущая версия) :

Пост был о том, что вложенность ифов можно уменьшить.

if testQ[myNome]["q33q"] != "недоуменно посмотри на персонажей: " then
 return
end

local msg = mysplit(message)

 if string.find (message, "Вы недоуменно смотрите") == 0 then
  return
 end

 for i=1,#msg do

  if testQ[myNome]["q33nik1"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik1"]) == 0 then
   continue
  end

  SendChatMessage("Я недоуменно смотрю на персонажа " .. 
testQ[myNome]["q33nik1"] , "OFFICER", nil, 1)

  testQ[myNome]["q33nik1"] = 1

 end

 for i=1,#msg do

  if testQ[myNome]["q33nik2"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik2"])  == 0 then
   continue
  end

  SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik2"] , "OFFICER", nil, 1)

  testQ[myNome]["q33nik1"] = 1

 end

 for i=1,#msg do

  if testQ[myNome]["q33nik3"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik3"]) == 0 then
   continue
  end

  SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik3"] , "OFFICER", nil, 1)

  testQ[myNome]["q33nik1"] = 1

 end

Исправление Forum0888, :

Пост был о том, что вложенность ифов можно уменьшить.

if testQ[myNome]["q33q"] != "недоуменно посмотри на персонажей: " then
 return
end

local msg = mysplit(message)

 if string.find (message, "Вы недоуменно смотрите") == 0 then
  return
 end

 for i=1,#msg do

  if testQ[myNome]["q33nik1"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik1"]) then
     SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik1"] , "OFFICER", nil, 1) == 0
   continue
  end

  testQ[myNome]["q33nik1"] = 1

 end

 for i=1,#msg do

  if testQ[myNome]["q33nik2"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik2"]) then
     SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik2"] , "OFFICER", nil, 1) == 0
   continue
  end

  testQ[myNome]["q33nik1"] = 1

 end

 for i=1,#msg do

  if testQ[myNome]["q33nik3"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik3"]) == 0 then
   continue
  end

  SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik3"] , "OFFICER", nil, 1)

  testQ[myNome]["q33nik1"] = 1

 end

Исходная версия Forum0888, :

Пост был о том, что вложенность ифов можно уменьшить.

if testQ[myNome]["q33q"] != "недоуменно посмотри на персонажей: " then
 return
end

local msg = mysplit(message)

 if string.find (message, "Вы недоуменно смотрите") == 0 then
  return
 end

 for i=1,#msg do

  if testQ[myNome]["q33nik1"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik1"]) then
     SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik1"] , "OFFICER", nil, 1)
      testQ[myNome]["q33nik1"] = 1
  end

 end

 for i=1,#msg do

  if testQ[myNome]["q33nik2"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik2"]) then
     SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik2"] , "OFFICER", nil, 1)
      testQ[myNome]["q33nik1"] = 1
  end

 end

 for i=1,#msg do

  if testQ[myNome]["q33nik3"] == 1 then
   continue
  end

  if string.find(msg[i],testQ[myNome]["q33nik3"]) then
     SendChatMessage("Я недоуменно смотрю на персонажа " .. testQ[myNome]["q33nik3"] , "OFFICER", nil, 1)
      testQ[myNome]["q33nik1"] = 1
  end

 end