Fix non-working lua Lock (#2945)

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
This commit is contained in:
Dmitry Maluka 2023-10-16 10:45:37 +02:00 committed by GitHub
parent db5fcf11a9
commit dc6a275e04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}