Fix bug with init.lua

This commit is contained in:
Zachary Yedidia
2016-08-25 17:29:58 -04:00
parent acc03e9707
commit e634b4e180
3 changed files with 11 additions and 3 deletions

View File

@@ -142,8 +142,11 @@ func LoadPlugins() {
}
if _, err := os.Stat(configDir + "/init.lua"); err == nil {
if err := L.DoFile(configDir + "/init.lua"); err != nil {
pluginDef := "\nlocal P = {}\n" + "init" + " = P\nsetmetatable(" + "init" + ", {__index = _G})\nsetfenv(1, P)\n"
data, _ := ioutil.ReadFile(configDir + "/init.lua")
if err := L.DoString(pluginDef + string(data)); err != nil {
TermMessage(err)
}
loadedPlugins = append(loadedPlugins, "init")
}
}

File diff suppressed because one or more lines are too long