lua table - String Comparison in Lua -


trying create dictionary function, first made 2 dimensional table:

dictionary = {} = 1, 52   dictionary[i] = {} end 

then read in txt file words dictionary table has 26 entries uppercase , likewise lowercase.

when try search through table compare words i'm having difficulty:

test = dictionary[1][176] testtwo = "ave"  if test == testtwo print("the strings same") else print("they not same) end 

i know @ dictionary[1][176] "ave" when try comparisons not equal.

in reply answers how reading in dictionary:

function createdictionary()    io.input("dictionary.txt")   dictionary = {}   line in io.lines()     print(type(line))     table.insert(dictionary, line)   end end 

you haven't set dictionary[1][176] ave, because when run piece of code the strings same.

to set ave that:

dictionary[1][176] = "ave" 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -