lua - How do I add a config list am I doing it wrongly? -


the issue recieving making txt files contents readable in listed format such as:

  • word1
  • word2
  • word3

if user have said of words/or phrases response otherwise program wait valid reply blacklisted word file.

local valid; repeat local reply = io.read() file = io.open('blacklist.txt', "r+") file:read() file:close()    -- list equal contents within blacklist.txt if reply == list   valid = reply   print("kicking user game")   --game.kick.saiduser else --do nothing , wait valid response end until valid;  

file:read() reads 1 line file , discards it.

i think want read whole contents of file list with

list = file:read("*a") 

then want check whether reply in list with

if list:match("\n"..reply.."\n") 

you may want read list outside loop , prepend \n list make pattern matching simpler.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -