Topic: help : io.open can't find file

I want to use lua to open a text file and read the lines
my code goes like this

file = assert(io.open("textfile.txt", "r"))
for line in file:lines() do
  print(line)
end
file:close()

yet I got following error
[string "function split(pString, pPattern)..."]:42: textfile.txt: No such file or
directory

I try to put textfile.txt in any logical directory but it can't find it. Where should it be?
I'm on Linux/Ubuntu btw

Thanks

Re: help : io.open can't find file

There is a topic about it : http://forum.maratis3d.com/viewtopic.php?id=662

basically in :
        "/Maratis/Bin" for unpublished projects
        "/MyProject/published" for published projects

I'll add something to simplify this in the future, but in the current version the file need to be in the binary directory.

Re: help : io.open can't find file

Ah, so it is in binary folder. Never thought about it. Didn't find the topic either even though I've been reading some of the post.

Well, the idea was to read text file that store object to clone, position and rotation and clone those object and put them to right place.
Reading text file is done, but cloning the object seems to be another challenge, especially since this is my first time with lua

I'm going to dig more, if any of you have suggestion on how to do that, please reply

Thanks

[Edit]

I manage to do it using
table.insert(cloneList, #cloneList + 1, getClone(object))

it was actually nice and easy. This is much better than early my expectation

Last edited by penguinroad (2013-07-17 09:56:11)