Page 1 of 4

Automatically converting 0.5.0 games to 0.6.0

Posted: Fri Jan 08, 2010 11:27 am
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.

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Wed Jan 20, 2010 12:41 am
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]: ?

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Wed Jan 20, 2010 12:02 pm
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.

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Sun Feb 07, 2010 1:59 pm
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).

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Sun Feb 07, 2010 4:08 pm
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]: ?

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Sun Feb 07, 2010 4:34 pm
by Robin
Whoops. I'll upload a fixed version.

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Sun Feb 07, 2010 6:53 pm
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]: ?

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Sun Feb 07, 2010 7:21 pm
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.

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Sun Feb 07, 2010 8:16 pm
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 :)

Re: Automatically converting 0.5.0 games to 0.6.0

Posted: Sun Feb 07, 2010 8:23 pm
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?