Skip to content

Commit

Permalink
Fix non-working lua Lock (#2945)
Browse files Browse the repository at this point in the history
The lock provided to lua as micro.Lock does not really work: an attempt
to use it via micro.Lock:Lock() results in an error:

Plugin initlua: init:260: attempt to call a non-function object
stack traceback:
	init:260: in main chunk
	[G]: ?

The reason is that the value that is provided to lua is a copy of the
mutex, not the mutex itself.

Ref #1539
  • Loading branch information
dmaluka authored Oct 16, 2023
1 parent db5fcf1 commit dc6a275
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/micro/initlua.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func luaImportMicro() *lua.LTable {
ulua.L.SetField(pkg, "Tabs", luar.New(ulua.L, func() *action.TabList {
return action.Tabs
}))
ulua.L.SetField(pkg, "Lock", luar.New(ulua.L, ulua.Lock))
ulua.L.SetField(pkg, "Lock", luar.New(ulua.L, &ulua.Lock))

return pkg
}
Expand Down

0 comments on commit dc6a275

Please sign in to comment.