I am using Lua and i have a file that i want to split each line into two different arrays. Each line of my file contains two string seperated with a space. for example if my file contains
something something_else
I should have
tab_1[1] = something
tab_2[1] = something_else
I tried using split like
file =io.open("myfile.txt", "r")
for line in file:lines() do
line = file:read()
for value in split(line," ")
table.insert(tab_1,value[i])
table.insert(tab_2,value[i])
i=i+1
end
it seems to be wrong as i know split probably does not return an array but i know that it return different string . How can i manage them .
tab_1[1]andtab_2[2]? That seems a bit strange. Also, from your code it seems more like you wanttab_1[1]andtab_2[1].