MCPcopy Index your code
hub / github.com/Shopify/go-lua / Load

Method Load

lua.go:425–438  ·  view source on GitHub ↗

Load loads a Lua chunk, without running it. If there are no errors, it pushes the compiled chunk as a Lua function on top of the stack. Otherwise, it pushes an error message. http://www.lua.org/manual/5.2/manual.html#lua_load

(r io.Reader, chunkName string, mode string)

Source from the content-addressed store, hash-verified

423//
424// http://www.lua.org/manual/5.2/manual.html#lua_load
425func (l *State) Load(r io.Reader, chunkName string, mode string) error {
426 if chunkName == "" {
427 chunkName = "?"
428 }
429
430 if err := protectedParser(l, r, chunkName, mode); err != nil {
431 return err
432 }
433
434 if f := l.stack[l.top-1].(*luaClosure); f.upValueCount() == 1 {
435 f.setUpValue(0, l.global.registry.atInt(RegistryIndexGlobals))
436 }
437 return nil
438}
439
440// Dump dumps a function as a binary chunk. It receives a Lua function on
441// the top of the stack and produces a binary chunk that, if loaded again,

Callers 6

TestLocIsCorrectOnErrorFunction · 0.95
base.goFile · 0.80
LoadFileFunction · 0.80
LoadBufferFunction · 0.80

Calls 4

protectedParserFunction · 0.85
atIntMethod · 0.80
upValueCountMethod · 0.65
setUpValueMethod · 0.65

Tested by 3

TestLocIsCorrectOnErrorFunction · 0.76