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

Method SetFEnv

state.go:1878–1893  ·  view source on GitHub ↗
(obj LValue, env LValue)

Source from the content-addressed store, hash-verified

1876}
1877
1878func (ls *LState) SetFEnv(obj LValue, env LValue) {
1879 tb, ok := env.(*LTable)
1880 if !ok {
1881 ls.RaiseError("cannot use %v as an environment", env.Type().String())
1882 }
1883
1884 switch lv := obj.(type) {
1885 case *LFunction:
1886 lv.Env = tb
1887 case *LUserData:
1888 lv.Env = tb
1889 case *LState:
1890 lv.Env = tb
1891 }
1892 /* do nothing */
1893}
1894
1895/* }}} */
1896

Callers 2

loModuleFunction · 0.45
debugSetFEnvFunction · 0.45

Calls 3

RaiseErrorMethod · 0.95
StringMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected