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)
| 423 | // |
| 424 | // http://www.lua.org/manual/5.2/manual.html#lua_load |
| 425 | func (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, |