JesseH wrote:
I think being able to boot the love games directly would be very cool! I could totally see myself buying a R-Pi just for love games.
Suggestions:
1. I would love to be able to see the possibility of exiting running games and returning to the CLI.
2. The possibility of an overlay CLI using a keybind. Basically everything going on in the booted game is paused and overlayed with the CLI. You could implement this by modifying love.run
Robin wrote:That's pretty neat, but why does it export 23 globals? To wit:
loveos
loveos_cmd_num
loveos_screen_width
loveos_screen_height
loveos_start_x
loveos_start_y
loveos_font
loveos_dir
loveos_cursor_default
loveos_font_w
loveos_font_h
loveos_cursor_x
loveos_cursor_y
loveos_cursor_orig
loveos_cursor
loveos_backlog_max
loveos_upper
loveos_is_letter
cd
mkdir
ls
rm
help
Why not put the first batch in the loveos table and why not pass the latter few as arguments to loveos:add_function?
I was just curious. How do you find out what globals are being used by your project? Is there a command that will print out a list of them? I'd be curious to see if I forgot to make some stuff localized.
Interesting. That works. There's a lot of functions listed there too. (Obviously) I seem to have a lot of globals. Are there any other tips out there? Is there a way to separate the variables from the functions or is Lua so flexible that both are one in the same?
Edit: Thanks to this I have been able to shrink my list of globals down significantly and found some accidental ones. I just wish it would also export what file/line the global was defined on to make it easier to find some of the smaller variables. (Like I have one just called "c". Now I usually use that when calculating a color and I use it locally, but apparently I let one sneak by and it's hard to find because I can't figure out how to use text search to find just a c that's a variable and not part of another word. I'm sure there's a way using grep, but I don't know how grep works at all.)
Jasoco wrote:I just wish it would also export what file/line the global was defined on to make it easier to find some of the smaller variables.
I haven't tried myself, but I have the vague idea, that this might work with metatables and the __newIndex metamethod. See in PiL. With that you can define a function that is called, whenever a global variable is set or updated. That way at least you can detect when a global variable is created.
I don't.. know how to use that at all. Or what it does.
Sorry to take this off track. Maybe someone can split this stuff starting with my question off into its own thread. I only asked out of curiosity really. From a user standpoint I wasn't even concerned about loose globals, but everyone seems to make a big deal about leaky variables so I thought I'd do some cleaning up. But the _G list is really plain. Just a table full of strings that are names of variables and functions. No other metadata at all.