Started refactoring Lua stuff. Added `require ""` statement support.
Finished refactoring query.lua