Give Lua access to most of the Go stdlib

This commit is contained in:
Zachary Yedidia
2017-09-09 17:37:08 -04:00
parent 4e531c2d1e
commit 64d574c35c
3 changed files with 541 additions and 10 deletions

View File

@@ -48,10 +48,6 @@ var (
CommitHash = "Unknown"
CompileDate = "Unknown"
// L is the lua state
// This is the VM that runs the plugins
L *lua.LState
// The list of views
tabs []*Tab
// This is the currently open tab
@@ -383,6 +379,9 @@ func main() {
L.SetGlobal("AddRuntimeFilesFromDirectory", luar.New(L, PluginAddRuntimeFilesFromDirectory))
L.SetGlobal("AddRuntimeFileFromMemory", luar.New(L, PluginAddRuntimeFileFromMemory))
// Access to Go stdlib
L.SetGlobal("import", luar.New(L, Import))
jobs = make(chan JobFunction, 100)
events = make(chan tcell.Event, 100)
autosave = make(chan bool)