Error: launching the .love in same directory than love.exe

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
tetrisDev
Prole
Posts: 3
Joined: Sun Mar 20, 2011 9:23 pm

Error: launching the .love in same directory than love.exe

Post by tetrisDev »

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 :cry:

Thank you.
User avatar
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

Post by Taehl »

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+.
tetrisDev
Prole
Posts: 3
Joined: Sun Mar 20, 2011 9:23 pm

Re: Error: launching the .love in same directory than love.e

Post by tetrisDev »

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...
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests