Automatically make new functions local

I think a super nice feature for editor 2 would be to make any new function you add, automatically local, just spent a day, wondering why my functions weren’t being called, only to realise I’d forgotten to make them local. :scream:

Or better yet a step debugger would be nice, I so miss that. :grin:

Not sure if you’ve tested it, but regarding step debugging, we support it. More info about it here

How would that work? Do you mean some kind of pre-processing of the Lua code before running it or that the editor somehow adds a local keyword before the function declaration while I’m writing it?

Na I don’t think I was being too serious, perhaps a post it note on the screen saying all functions would be better local, :relaxed: I was just so annoyed with myself for missing it.

Whaaaat, I never knew, noyce, thanks. :grin:

Well, what we could do, and probably will as we improve the Lua editor features is to incorporate a proper linter that would warn when you’re trying to access a global variable (just like the linter in Atom and Sublime, both of which are based on LuaCheck if I’m not mistaken).

2 Likes

and autocomplete of “function” could probably add a local by default :wink:

4 Likes