MCPcopy Create free account
hub / github.com/yuin/gopher-lua / OpenBase

Function OpenBase

baselib.go:14–24  ·  view source on GitHub ↗

* basic functions {{{ */

(L *LState)

Source from the content-addressed store, hash-verified

12/* basic functions {{{ */
13
14func OpenBase(L *LState) int {
15 global := L.Get(GlobalsIndex).(*LTable)
16 L.SetGlobal("_G", global)
17 L.SetGlobal("_VERSION", LString(LuaVersion))
18 L.SetGlobal("_GOPHER_LUA_VERSION", LString(PackageName+" "+PackageVersion))
19 basemod := L.RegisterModule("_G", baseFuncs)
20 global.RawSetString("ipairs", L.NewClosure(baseIpairs, L.NewFunction(ipairsaux)))
21 global.RawSetString("pairs", L.NewClosure(basePairs, L.NewFunction(pairsaux)))
22 L.Push(basemod)
23 return 1
24}
25
26var baseFuncs = map[string]LGFunction{
27 "assert": baseAssert,

Callers

nothing calls this directly

Calls 8

LStringTypeAlias · 0.85
RegisterModuleMethod · 0.80
RawSetStringMethod · 0.80
PushMethod · 0.65
GetMethod · 0.45
SetGlobalMethod · 0.45
NewClosureMethod · 0.45
NewFunctionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…