Пример #1
0
// Create a new list.
// id is the name of the list.
// dbindex is the Redis database index (typically 0).
func newList(L *lua.LState, creator pinterface.ICreator, id string) (*lua.LUserData, error) {
	// Create a new list
	list, err := creator.NewList(id)
	if err != nil {
		return nil, err
	}
	// Create a new userdata struct
	ud := L.NewUserData()
	ud.Value = list
	L.SetMetatable(ud, L.GetTypeMetatable(lListClass))
	return ud, nil
}