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

Method ToValue

lua.go:871–881  ·  view source on GitHub ↗

ToValue convertes the value at index into a generic Go interface{}. The value can be a userdata, a table, a thread, a function, or Go string, bool or float64 types. Otherwise, the function returns nil. Different objects will give different values. There is no way to convert the value back into it

(index int)

Source from the content-addressed store, hash-verified

869//
870// http://www.lua.org/manual/5.2/manual.html#lua_tovalue
871func (l *State) ToValue(index int) interface{} {
872 v := l.indexToValue(index)
873 switch v := v.(type) {
874 case string, float64, bool, *table, *luaClosure, *goClosure, *goFunction, *State:
875 case *userData:
876 return v.data
877 default:
878 return nil
879 }
880 return v
881}
882
883// PushString pushes a string onto the stack.
884//

Callers 3

ExampleFunction · 0.95
loadFunction · 0.80
ToStringMetaFunction · 0.80

Calls 1

indexToValueMethod · 0.95

Tested by 2

ExampleFunction · 0.76
loadFunction · 0.64