luaobject.go
func get(L *lua.State, subfields ...interface{}) error {
	// TODO: See if worth exporting.

	// Duplicate iterable since the following loop removes the last table on stack
	// and we don't want to pop it to be consistent with lua.GetField and
	// lua.GetTable.
	L.PushValue(-1)

	for _, field := range subfields {
		if L.IsTable(-1) {
			GoToLua(L, field)
			L.GetTable(-2)
		} else if L.GetMetaField(-1, "__index") {
			L.PushValue(-2)
			GoToLua(L, field)
			err := L.Call(2, 1)
			if err != nil {
				L.Pop(1)
				return err
			}
		} else {
			return ErrLuaObjectIndexable
		}
		// Remove last iterable.
		L.Remove(-2)
	}
	return nil
}
func get(L *lua.State, subfields ...interface{}) error {
	// TODO: See if worth exporting.

	// Duplicate iterable since the following loop removes the last table on stack
	// and we don't want to pop it to be consistent with lua.GetField and
	// lua.GetTable.
	L.PushValue(-1)

	for _, field := range subfields {
		if L.IsTable(-1) {
			GoToLua(L, field)
			L.GetTable(-2)
		} else if L.GetMetaField(-1, "__index") {
			L.PushValue(-2)
			GoToLua(L, field)
			err := L.Call(2, 1)
			if err != nil {
				L.Pop(1)
				return err
			}
		} else {
			return ErrLuaObjectIndexable
		}
		// Remove last iterable.
		L.Remove(-2)
	}
	return nil
}
func get ( L * lua . State , subfields ... interface { } ) error { // TODO: See if worth exporting. // Duplicate iterable since the following loop removes the last table on stack // and we don't want to pop it to be consistent with lua.GetField and // lua.GetTable. L . PushValue ( - 1 ) for _ , field := range subfields { if L . IsTable ( - 1 ) { GoToLua ( L , field ) L . GetTable ( - 2 ) } else if L . GetMetaField ( - 1 , " " ) { L . PushValue ( - 2 ) GoToLua ( L , field ) err := L . Call ( 2 , 1 ) if err != nil { L . Pop ( 1 ) return err } } else { return ErrLuaObjectIndexable } // Remove last iterable. L . Remove ( - 2 ) } return nil }
// get pushes the Lua value indexed at the sequence of 'subfields' from the
// indexable value on top of the stack.
//
// It pushes nothing on error.
//
// Numeric indices start from 1: see Set().
get pushes the Lua value indexed at the sequence of subfields from the indexable value on top of the stack . It pushes nothing on error . Numeric indices start from 1 : see Set () .