// Create a new hash map. // id is the name of the hash map. // dbindex is the Redis database index (typically 0). func newHashMap(L *lua.LState, creator pinterface.ICreator, id string) (*lua.LUserData, error) { // Create a new hash map hash, err := creator.NewHashMap(id) if err != nil { return nil, err } // Create a new userdata struct ud := L.NewUserData() ud.Value = hash L.SetMetatable(ud, L.GetTypeMetatable(lHashClass)) return ud, nil }