add comment and let multi values to the log to make it easy to log. (#788)

* add comment and let multi values to the log to make it easy to log.

* added WorkingDirectory to lua bindings (returns the current directory)
This commit is contained in:
Tommy
2017-08-27 17:18:56 +01:00
committed by Zachary Yedidia
parent 0f62ef687c
commit 4f2fc096e5
2 changed files with 5 additions and 2 deletions

View File

@@ -70,9 +70,11 @@ type Messenger struct {
gutterMessage bool
}
func (m *Messenger) AddLog(msg string) {
// AddLog sends a message to the log view
func (m *Messenger) AddLog(msg ...interface{}) {
logMessage := fmt.Sprint(msg...)
buffer := m.getBuffer()
buffer.insert(buffer.End(), []byte(msg+"\n"))
buffer.insert(buffer.End(), []byte(logMessage+"\n"))
buffer.Cursor.Loc = buffer.End()
buffer.Cursor.Relocate()
}

View File

@@ -363,6 +363,7 @@ func main() {
L.SetGlobal("Loc", luar.New(L, func(x, y int) Loc {
return Loc{x, y}
}))
L.SetGlobal("WorkingDirectory", luar.New(L, os.Getwd))
L.SetGlobal("JoinPaths", luar.New(L, filepath.Join))
L.SetGlobal("DirectoryName", luar.New(L, filepath.Dir))
L.SetGlobal("configDir", luar.New(L, configDir))