Set a module loader to the package.preload table.
(name string, loader LGFunction)
| 430 | |
| 431 | // Set a module loader to the package.preload table. |
| 432 | func (ls *LState) PreloadModule(name string, loader LGFunction) { |
| 433 | preload := ls.GetField(ls.GetField(ls.Get(EnvironIndex), "package"), "preload") |
| 434 | if _, ok := preload.(*LTable); !ok { |
| 435 | ls.RaiseError("package.preload must be a table") |
| 436 | } |
| 437 | ls.SetField(preload, name, ls.NewFunction(loader)) |
| 438 | } |
| 439 | |
| 440 | // Checks whether the given index is an LChannel and returns this channel. |
| 441 | func (ls *LState) CheckChannel(n int) chan LValue { |
nothing calls this directly
no test coverage detected