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

Function NewState

lua.go:456–466  ·  view source on GitHub ↗

NewState creates a new thread running in a new, independent state. http://www.lua.org/manual/5.2/manual.html#lua_newstate

()

Source from the content-addressed store, hash-verified

454//
455// http://www.lua.org/manual/5.2/manual.html#lua_newstate
456func NewState() *State {
457 v := float64(VersionNumber)
458 l := &State{allowHook: true, error: nil, nonYieldableCallCount: 1}
459 g := &globalState{mainThread: l, registry: newTable(), version: &v, memoryErrorMessage: "not enough memory"}
460 l.global = g
461 l.initializeStack()
462 g.registry.putAtInt(RegistryIndexMainThread, l)
463 g.registry.putAtInt(RegistryIndexGlobals, newTable())
464 copy(g.tagMethodNames[:], eventNames)
465 return l
466}
467
468func apiCheckStackIndex(index int, v value) {
469 if apiCheck && (v == none || isPseudoIndex(index)) {

Callers 15

TestParserFunction · 0.85
TestEmptyStringFunction · 0.85
TestParserExhaustivelyFunction · 0.85
testStringHelperFunction · 0.85
TestProtectedCallFunction · 0.85
TestLuaFunction · 0.85
benchmarkSortFunction · 0.85
BenchmarkFibonnaciFunction · 0.85

Calls 3

initializeStackMethod · 0.95
newTableFunction · 0.85
putAtIntMethod · 0.80

Tested by 15

TestParserFunction · 0.68
TestEmptyStringFunction · 0.68
TestParserExhaustivelyFunction · 0.68
testStringHelperFunction · 0.68
TestProtectedCallFunction · 0.68
TestLuaFunction · 0.68
benchmarkSortFunction · 0.68
BenchmarkFibonnaciFunction · 0.68