2024-07-21 15:37:08 +00:00
|
|
|
//go:build !midnight
|
2024-07-19 20:54:15 +00:00
|
|
|
package moonlight
|
|
|
|
|
|
|
|
import (
|
|
|
|
rt "github.com/arnodel/golua/runtime"
|
|
|
|
"github.com/arnodel/golua/lib"
|
|
|
|
"github.com/arnodel/golua/lib/packagelib"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Loader func(*Runtime) Value
|
|
|
|
|
|
|
|
func (mlr *Runtime) LoadLibrary(ldr Loader, name string) {
|
|
|
|
goluaLoader := packagelib.Loader{
|
|
|
|
Load: func(rt *rt.Runtime) (rt.Value, func()) {
|
|
|
|
val := ldr(specificRuntimeToGeneric(rt))
|
|
|
|
|
|
|
|
return val, nil
|
|
|
|
},
|
|
|
|
Name: name,
|
|
|
|
}
|
|
|
|
|
|
|
|
lib.LoadLibs(mlr.rt, goluaLoader)
|
|
|
|
}
|