Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lua syntax check when save lua file in sublime
import sublime, sublime_plugin
import os
import re
regex = re.compile('.*:(\d+):.*')
class LuaParseCheck(sublime_plugin.EventListener):
def on_post_save_async(self, view):
path = view.file_name()
if os.path.splitext(path)[-1] != ".lua":return
result = os.popen("/usr/local/bin/luac -p '"+path+"' 2>&1").read()
if result == "":return
view.run_command("goto_line", {"line": regex.search(result).group(1)} )
sublime.status_message(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.