OpenLibs loads the built-in libraries. It is equivalent to running OpenLoad, then OpenBase, then iterating over the other OpenXXX functions in any order.
()
| 44 | // OpenLibs loads the built-in libraries. It is equivalent to running OpenLoad, |
| 45 | // then OpenBase, then iterating over the other OpenXXX functions in any order. |
| 46 | func (ls *LState) OpenLibs() { |
| 47 | // NB: Map iteration order in Go is deliberately randomised, so must open Load/Base |
| 48 | // prior to iterating. |
| 49 | for _, lib := range luaLibs { |
| 50 | ls.Push(ls.NewFunction(lib.libFunc)) |
| 51 | ls.Push(LString(lib.libName)) |
| 52 | ls.Call(1, 0) |
| 53 | } |
| 54 | } |