Automatically converting 0.5.0 games to 0.6.0

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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

Well, that won't happen. But I have a script that finds things that have changed, and warns you about them.

It is not completely ready. I must have forgotten a few things, and it might crash, but general this will find quite some things.

To use it, run

Code: Select all

cd /my/game/project/folder/
lua /path/to/downloads/hand-holder.lua
If you have feedback, especially negative, please report it here.

Known issues
None at the moment.

Edits
  1. the file has no license attached, but I release it under CC0/Public Domain.
  2. new version uploaded (v0.1), which does a lot to ensure every bit of code is run
  3. new version (v0.1.1), which is helluva lot better at handling for loops (thank you, bartbes), and also removes a superfluous print() statement (sorry 'bout that)
  4. new version (v0.2), which adds a list of constants straight from constants.lua, to give proper suggestions for string constants to be used instead.
  5. new version (v0.3), which skips replacement added in v0.1 for secs.lua and, more generally, any file that doesn't mention love, is nicer when crashing, doesn't crash so easily, and reports newColor as removed (which it didn't do previously) (thank you, TechnoCat).
  6. new version (v0.4), which has an aggressive option (use -a on the command line), that replaces old-style constants to string constants, so you don't have to bother replacing them by hand. I recommend you make a backup first though.
  7. new version (v0.4.1), which (hopefully) fixes a rather stupid mistake.
  8. new version (v0.5), which is truly horrible.
    • It no longer assumes everybody knows load/update/draw are now in the love table.
    • It now recognises use of love.filesystem.require and incorrect filenames ('my/lib.lua' instead of 'my.lib.lua') and gives an appropriate warning
    • Fixes all kind of bad stuff related to tables with key names 'draw', 'load' or 'update'.
    • Added LUBE to safe libs that don't need to be checked.
  9. new version (v0.5.1), I can't remember what I did, but it hopefully solves some crashes.
  10. new version (v0.5.2), which handles all callbacks, instead of just load, update and draw. See http://love2d.org/forum/viewtopic.php?f ... =20#p13803.
Attachments
hand-holder.lua
It holds your hand while converting to 0.6 (v0.5.1)
(9.63 KiB) Downloaded 254 times
hand-holder.lua
v0.4.1
(8.66 KiB) Downloaded 235 times
hand-holder.lua
v0.3
(7.65 KiB) Downloaded 251 times
Last edited by Robin on Sun Mar 14, 2010 12:30 pm, edited 6 times in total.
Help us help you: attach a .love.
User avatar
middlerun
Citizen
Posts: 64
Joined: Tue Nov 25, 2008 4:31 am
Location: Sydney, Australia
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by middlerun »

I tried to run it on my old Garfield game, and I got this:

Code: Select all

eddie@thefunk:~/love/garfield-0.6$ lua /home/eddie/Desktop/hand-holder.lua
hand-holder (v0.2) for converting LÖVE 0.5.0 to 0.6.0
lua: /home/eddie/Desktop/hand-holder.lua:144: bad argument #1 to 'setfenv' (number expected, got nil)
stack traceback:
	[C]: in function 'setfenv'
	/home/eddie/Desktop/hand-holder.lua:144: in main chunk
	[C]: ?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

That happens if your game contains syntax errors.

If you can't find any, please attach your main.lua. If there is a problem with hand-holder I will try and fix it.
Help us help you: attach a .love.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

As the top post states, it has many improvements now, and I'm working on a feature that automatically replaces constants with strings (activated by command line switch).
Help us help you: attach a .love.
User avatar
luisfcorreia
Prole
Posts: 4
Joined: Sun Jan 10, 2010 4:17 pm
Location: Belas, Portugal
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by luisfcorreia »

Hey, got an error:

Code: Select all

hand-holder (v0.4) for porting games for LÖVE 0.5.0 to 0.6.0
lua: /home/lfcorreia/Download/hand-holder.lua:20: attempt to get length of global 'cfiles' (a nil value)
stack traceback:
	/home/lfcorreia/Download/hand-holder.lua:20: in function 'warn'
	/home/lfcorreia/Download/hand-holder.lua:35: in main chunk
	[C]: ?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

Whoops. I'll upload a fixed version.
Help us help you: attach a .love.
User avatar
luisfcorreia
Prole
Posts: 4
Joined: Sun Jan 10, 2010 4:17 pm
Location: Belas, Portugal
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by luisfcorreia »

it still isn't fixed :(

Code: Select all

hand-holder (v0.4) for porting games for LÖVE 0.5.0 to 0.6.0
lua: /home/lfcorreia/Download/hand-holder.lua:225: bad argument #1 to 'setfenv' (number expected, got nil)
stack traceback:
	[C]: in function 'setfenv'
	/home/lfcorreia/Download/hand-holder.lua:225: in main chunk
	[C]: ?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

It means a file was require()d that has an error somewhere.

I can make a new version that is a bit more graceful about it, but hand-holder was written to assume the game would not give any error.
Help us help you: attach a .love.
User avatar
luisfcorreia
Prole
Posts: 4
Joined: Sun Jan 10, 2010 4:17 pm
Location: Belas, Portugal
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by luisfcorreia »

well, the game just runs fine in 0.5.0, so I really don't know what's wrong.

I'll convert the game myself, just wanted to make it simpler :)
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Automatically converting 0.5.0 games to 0.6.0

Post by Robin »

luisfcorreia wrote:well, the game just runs fine in 0.5.0, so I really don't know what's wrong.
I'm sorry, I really want this script to help people.
luisfcorreia wrote:I'll convert the game myself, just wanted to make it simpler :)
Sure, that's what you'll have to do anyway. Did it at least help you to trace a few things that needed changing?
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: No registered users and 91 guests