Skip to content

Commit 3ff1566

Browse files
committed
nvim: add ExecLua function
1 parent ad64216 commit 3ff1566

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

nvim/apitool.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ var specialAPIs = map[string]bool{
358358
"nvim_call_function": true,
359359
"nvim_call_dict_function": true,
360360
"nvim_execute_lua": true,
361+
"nvim_exec_lua": true,
361362
}
362363

363364
func compareFunctions(functions []*Function) error {

nvim/nvim.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,25 @@ func (b *Batch) CallDict(dict []interface{}, fname string, result interface{}, a
587587
b.call("nvim_call_dict_function", result, fname, dict, args)
588588
}
589589

590+
// ExecLua executes a Lua block.
591+
func (v *Nvim) ExecLua(code string, result interface{}, args ...interface{}) error {
592+
if args == nil {
593+
args = []interface{}{}
594+
}
595+
return v.call("nvim_exec_lua", result, code, args)
596+
}
597+
598+
// ExecLua executes a Lua block.
599+
func (b *Batch) ExecLua(code string, result interface{}, args ...interface{}) {
600+
if args == nil {
601+
args = []interface{}{}
602+
}
603+
b.call("nvim_exec_lua", result, code, args)
604+
}
605+
590606
// ExecuteLua executes a Lua block.
607+
//
608+
// Deprecated: Use ExecLua() instead.
591609
func (v *Nvim) ExecuteLua(code string, result interface{}, args ...interface{}) error {
592610
if args == nil {
593611
args = []interface{}{}
@@ -596,6 +614,8 @@ func (v *Nvim) ExecuteLua(code string, result interface{}, args ...interface{})
596614
}
597615

598616
// ExecuteLua executes a Lua block.
617+
//
618+
// Deprecated: Use ExecLua() instead.
599619
func (b *Batch) ExecuteLua(code string, result interface{}, args ...interface{}) {
600620
if args == nil {
601621
args = []interface{}{}

0 commit comments

Comments
 (0)