MCPcopy Index your code
hub / github.com/yuin/gopher-lua / NewState

Function NewState

state.go:1406–1435  ·  view source on GitHub ↗

* }}} */ * api methods {{{ */

(opts ...Options)

Source from the content-addressed store, hash-verified

1404/* api methods {{{ */
1405
1406func NewState(opts ...Options) *LState {
1407 var ls *LState
1408 if len(opts) == 0 {
1409 ls = newLState(Options{
1410 CallStackSize: CallStackSize,
1411 RegistrySize: RegistrySize,
1412 })
1413 ls.OpenLibs()
1414 } else {
1415 if opts[0].CallStackSize < 1 {
1416 opts[0].CallStackSize = CallStackSize
1417 }
1418 if opts[0].RegistrySize < 128 {
1419 opts[0].RegistrySize = RegistrySize
1420 }
1421 if opts[0].RegistryMaxSize < opts[0].RegistrySize {
1422 opts[0].RegistryMaxSize = 0 // disable growth if max size is smaller than initial size
1423 } else {
1424 // if growth enabled, grow step is set
1425 if opts[0].RegistryGrowStep < 1 {
1426 opts[0].RegistryGrowStep = RegistryGrowStep
1427 }
1428 }
1429 ls = newLState(opts[0])
1430 if !opts[0].SkipOpenLibs {
1431 ls.OpenLibs()
1432 }
1433 }
1434 return ls
1435}
1436
1437func (ls *LState) IsClosed() bool {
1438 return ls.stack == nil

Callers 15

TestTableLenTypeFunction · 0.70
TestCheckIntFunction · 0.70
TestCheckInt64Function · 0.70
TestCheckNumberFunction · 0.70
TestCheckStringFunction · 0.70
TestCheckBoolFunction · 0.70
TestCheckTableFunction · 0.70
TestCheckFunctionFunction · 0.70
TestCheckUserDataFunction · 0.70
TestCheckThreadFunction · 0.70

Calls 2

OpenLibsMethod · 0.95
newLStateFunction · 0.70

Tested by 15

TestTableLenTypeFunction · 0.56
TestCheckIntFunction · 0.56
TestCheckInt64Function · 0.56
TestCheckNumberFunction · 0.56
TestCheckStringFunction · 0.56
TestCheckBoolFunction · 0.56
TestCheckTableFunction · 0.56
TestCheckFunctionFunction · 0.56
TestCheckUserDataFunction · 0.56
TestCheckThreadFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…