MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / SaveColorPattern

Function SaveColorPattern

internal/colorpatterns/admin.go:23–36  ·  view source on GitHub ↗

SaveColorPattern adds or replaces a named color pattern in memory and persists the file.

(name string, colors []int)

Source from the content-addressed store, hash-verified

21
22// SaveColorPattern adds or replaces a named color pattern in memory and persists the file.
23func SaveColorPattern(name string, colors []int) error {
24 if name == "" {
25 return fmt.Errorf("color pattern name cannot be empty")
26 }
27 if len(colors) == 0 {
28 return fmt.Errorf("color pattern must have at least one color value")
29 }
30 cp := make([]int, len(colors))
31 copy(cp, colors)
32 numericPatterns[name] = cp
33 colorsCompiled = false
34 CompileColorPatterns()
35 return saveColorPatternsFile()
36}
37
38// DeleteColorPattern removes a named color pattern from memory and persists the file.
39func DeleteColorPattern(name string) error {

Callers 2

apiV1CreateColorPatternFunction · 0.92
apiV1PatchColorPatternsFunction · 0.92

Calls 2

CompileColorPatternsFunction · 0.85
saveColorPatternsFileFunction · 0.85

Tested by

no test coverage detected