Hi everyone, I’m programming a multilingual game and I decided to make different txt files for each language. when the game start after choose one language will be loaded the specific txt file, in this file every lines is separated by a “#” that is filtered by a function. My problem is that in the simulator all works great but when I make the apk and I install the game in my tablet the “#” is not filtered and appear in the main text like a line of text. Here my code, I hope someone can help me thanks!
string = composer.getVariable( "stringa" )
local path = system.pathForFile( string )
-- Open the file handle
local file, errorString = io.open( path, "r" )
if not file then
-- Error occurred; output the cause
print( "File error: " .. errorString )
else
-- Read data from file
lines = {}
-- io.lines returns an iterator, so we need to manually unpack it into an array
for line in io.lines(path) do
lines[#lines+1] = line
end
for i = 1, #lines do
if lines[i] == "#" then
table.remove(lines, i)
end
end
contents = lines[1]
print( "Contents of " .. path .. "\n" .. contents)
for i,v in ipairs(lines) do print(i,v) end
-- Close the file handle
io.close( file )
end
txt file structure:
some text in first line
-#
some other text in second line
-#
some other text in third line