Hi,
I've started to develop an original game call Tetris with love !
The game run correctly if I launch the game like that from the command prompt:
../love.exe tetris.love (in this case the file is in the same directory than love.exe
or like that
../love.exe ../tetris.love (here in the sub directory tetris)
I launch it from the directory tetris.
(windows XP SP3)
directory structure is:
love
love\tetris
love\tetris\resources
love\tetris\txt
but If I launch it
love.exe tetris.love or drag the .love in the love.exe
I get an error it seems that the "system" is unable to read or find a text file in the subdirectory txt.
I use the lua library libSaveTableToFile
Error: [string "menu.lua"]:9: attempt to get length of field 'menuItems' (a nil
value)
stack traceback:
the call is :
self.menuItems = table.load("txt/menu_"..lang..".txt")
self.nbItems = #self.menuItems
I've try to put the directory "txt" in the same directory than love.exe without success.
Any help are very welcome. I'm
Thank you.
Error: launching the .love in same directory than love.exe
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Error: launching the .love in same directory than love.e
Looks like you have the wrong kind of slash. You need to keep your filepaths UNIX-style.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Re: Error: launching the .love in same directory than love.e
Thanks for your answer.
I try to put the file in the root and call it like that
self.menuItems = table.load("menu_en.".txt")
but I get the same error.
I use the "/" everywhere in the code not the "\". I also take care of the case.
I add this code with the file in the same directory then main.lua
filename="menu_"..lang..".txt"
f = io.open(filename, "r")
if (f ~= nil) then
local t = f:read("*all")
print(t)
f:close()
else
print("Cannot open", filename)
end
It's still not work when I drag and drop the .love in the love.exe
But I've the message Cannot open... in the console.
I've do another test and putting the directory txt in the same folder than love.exe and it's work if I lauch it by command line
love.exe tetris.love
But not if I drag and drop...
I try to put the file in the root and call it like that
self.menuItems = table.load("menu_en.".txt")
but I get the same error.
I use the "/" everywhere in the code not the "\". I also take care of the case.
I add this code with the file in the same directory then main.lua
filename="menu_"..lang..".txt"
f = io.open(filename, "r")
if (f ~= nil) then
local t = f:read("*all")
print(t)
f:close()
else
print("Cannot open", filename)
end
It's still not work when I drag and drop the .love in the love.exe
But I've the message Cannot open... in the console.
I've do another test and putting the directory txt in the same folder than love.exe and it's work if I lauch it by command line
love.exe tetris.love
But not if I drag and drop...
Who is online
Users browsing this forum: No registered users and 14 guests