MCPcopy
hub / github.com/micro-editor/micro / LoadFile

Function LoadFile

internal/lua/lua.go:31–40  ·  view source on GitHub ↗

LoadFile loads a lua file

(module string, file string, data []byte)

Source from the content-addressed store, hash-verified

29
30// LoadFile loads a lua file
31func LoadFile(module string, file string, data []byte) error {
32 pluginDef := []byte("module(\"" + module + "\", package.seeall)")
33
34 if fn, err := L.Load(bytes.NewReader(append(pluginDef, data...)), file); err != nil {
35 return err
36 } else {
37 L.Push(fn)
38 return L.PCall(0, lua.MultRet, nil)
39 }
40}
41
42// Import allows a lua plugin to import a package
43func Import(pkg string) *lua.LTable {

Callers

nothing calls this directly

Calls 2

LoadMethod · 0.80
PushMethod · 0.80

Tested by

no test coverage detected