When I press shift+tab while in the editor window, the game hangs
Doesn't happen here, maybe just a hotkey in your WM/DE to freeze or switch the window or something.
once I had an error in my code and when I tried to execute it, your mod reported that /Moon_Logic/control.lua:117, k is nil
Might be something already fixed, but maybe make a screenshot of the backtrace next time, should be easier to check then.