Jump to content




LÖVE - 0.9.0 released!


56 replies to this topic

#41 Alice

  • Members
  • 429 posts
  • LocationBehind you.

Posted 15 December 2013 - 08:45 PM

I thought 'real' lua only had access to the current and subdirectories.

#42 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 15 December 2013 - 09:04 PM

"Real Lua" has access to everywhere and everything. Its io library is simply limited in that it can only directly read and write files and streams, and not do tasks like get directory lists, get the user directory and such. (You could probably accomplish these using hacky methods with io.popen, but still).

Edited by Kingdaro, 15 December 2013 - 09:05 PM.


#43 Alice

  • Members
  • 429 posts
  • LocationBehind you.

Posted 15 December 2013 - 09:21 PM

Just found out Love is programmed with .cpp files, what language is that?
Also, Engineer, if you have such a problem with it, change the source code and recompile :D

#44 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 15 December 2013 - 09:23 PM

View PostDeath, on 15 December 2013 - 09:21 PM, said:

Just found out Love is programmed with .cpp files, what language is that?
C++ (cpp === CPlusPlus)... this is because Lua can also be C++

Edited by theoriginalbit, 15 December 2013 - 09:23 PM.


#45 Alice

  • Members
  • 429 posts
  • LocationBehind you.

Posted 15 December 2013 - 09:27 PM

Find out where it changes the IO library, and find a way to take it out of the regular folder :D

#46 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 17 December 2013 - 01:38 AM

View PostDeath, on 15 December 2013 - 09:21 PM, said:

Just found out Love is programmed with .cpp files, what language is that?
Also, Engineer, if you have such a problem with it, change the source code and recompile :D/>
Yeah, and break whole löve... I can see that happening.. plus I don't know C++

#47 Shnupbups

  • Members
  • 596 posts
  • LocationThat place over there. Y'know. The one where I am.

Posted 25 December 2013 - 10:55 PM

View PostFreack100, on 14 September 2013 - 09:11 AM, said:

Is there a way to get the source of mari0?
Just for learning :D
Yes. Rename the .exe to a .zip and open it with WinRAR/7Zip.

#48 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 25 December 2013 - 11:01 PM

Or just get the .love, since .love files are literally renamed .zip files.

#49 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 08 January 2014 - 12:14 PM

Managed to persuade my head of computing to install Love on all the school computers.

Posted Image

#50 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 08 January 2014 - 12:54 PM

Now that this topic is bumped, a few questions about LÖVE:
1. Can you use local variables like this:
local image
local x
local y
function love.load()
  image = love.image.newImage("some-image.png")
  x = 10
  y = 20
end

function love. update(dt)
  x = x + 1--I realize that the dt isn't factored here.
  y = y + 1
end

function love.draw()
  love.graphics.draw(image, x, y)
end
or do you have to do this:
function love.load()
  image = love.image.newImage("some-image.png")
  x = 10
  y = 20
end

function love. update(dt)
  x = x + 1--I realize that the dt isn't factored here.
  y = y + 1
end

function love.draw()
  love.graphics.draw(image, x, y)
end

function love.quit()
  image = nil
  x = nil
  y = nil
end
Also, is there anyway I can save outside of the boundaries of love.filesystem (I heard that the io library won't work like this.)? I have a level editor in my upcoming game and I'd like my users to easily be able to share levels, and submit them for inclusion into the official game.

Edited by awsmazinggenius, 08 January 2014 - 12:56 PM.


#51 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 09 January 2014 - 03:18 PM

LÖVE hasn't changed the way variables work with Lua. Local variables still are only accessable within the scope of a block, and globals anywhere. Both of those examples would work. With the second, setting them to nil is unnecessary because the variables are GC'd when the game closes. As for which is better, it's personal preference, as LuaJIT is fast enough for it to not really matter beyond that point.

In terms of interaction between scripts, other required scripts can only access global variables. Example:
--# test.lua
foo = 5
local bar = 10

--# main.lua
require "test"
print(foo) --> 5
print(bar) --> nothing

View Postawsmazinggenius, on 08 January 2014 - 12:54 PM, said:

Also, is there anyway I can save outside of the boundaries of love.filesystem (I heard that the io library won't work like this.)? I have a level editor in my upcoming game and I'd like my users to easily be able to share levels, and submit them for inclusion into the official game.

LOVE's filesystem module can only save in a specific game directory, but the io library can indeed save outside of the filesystem directory; it can save anywhere you need. The only downside is that the io library can't list directories or a lot of operations something like LuaFileSystem could do. What you can do is use os.execute to open the game's map directory, so the user doesn't have to navigate to it manually. Of course, because the command differs from OS to OS, you'd need to check what the game is running on first using the system module:
local mapdir = love.filesystem.getSaveDirectory() .. "/maps"
if love.system.getOS() == "Windows" then
  os.execute('start "' .. mapdir .. '"')
elseif love.system.getOS() == "Linux" then
  os.execute('xdg-open "' .. mapdir .. '"')
elseif love.system.getOS() == "OS X" then
  --# etc
end

Edited by Kingdaro, 09 January 2014 - 06:30 PM.


#52 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 09 January 2014 - 05:38 PM

I can see where you are going with that, bit one major problem: You overwrite the OS table with the love.system.getOS() then try to access it ;)

#53 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 09 January 2014 - 06:11 PM

View Postawsmazinggenius, on 09 January 2014 - 05:38 PM, said:

I can see where you are going with that, bit one major problem: You overwrite the OS table with the love.system.getOS() then try to access it ;)/>
Nice catch :lol: fixed.

#54 Symmetryc

  • Members
  • 434 posts

Posted 09 January 2014 - 06:13 PM

View PostKingdaro, on 09 January 2014 - 06:11 PM, said:

View Postawsmazinggenius, on 09 January 2014 - 05:38 PM, said:

I can see where you are going with that, bit one major problem: You overwrite the OS table with the love.system.getOS() then try to access it ;)/>/>
Nice catch :lol:/> fixed.
Also, not that is matters, but you missed the concatenation operator in the Linux section :P.

#55 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 09 January 2014 - 06:30 PM


View PostSymmetryc, on 09 January 2014 - 06:13 PM, said:

View PostKingdaro, on 09 January 2014 - 06:11 PM, said:

View Postawsmazinggenius, on 09 January 2014 - 05:38 PM, said:

I can see where you are going with that, bit one major problem: You overwrite the OS table with the love.system.getOS() then try to access it ;)/>/>/>
Nice catch :lol:/>/> fixed.
Also, not that is matters, but you missed the concatenation operator in the Linux section :P/>.
For the record, that still technically would be valid syntax :P

#56 Symmetryc

  • Members
  • 434 posts

Posted 09 January 2014 - 06:31 PM

View PostKingdaro, on 09 January 2014 - 06:30 PM, said:

For the record, that still technically would be valid syntax :P
Well, syntax, but once it tries to call mapdir it would error :P.

#57 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 09 January 2014 - 06:58 PM

If the reason you put 'etc.' for the OS X terminal command is because you don't know what it is, it is just open <file/whatever else> with some optional flags about how to open the file. (eg must be opened in a certain application (for files), must be opened hidden, etc.)





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users