write

public static void write(Path folder, String name, Function<String, InputStream> resources)

Writes the shipped behavior module name to folder/name.lua from the resource pet_behaviors/name.lua that resources opens (null when there is none). It goes to a temporary file beside it first, which no load reads since its name does not end in .lua, forced to disk, and is then moved into place in one step, or with a plain move that never replaces a file where the atomic move fails. So a crash never leaves a partly written default, which the next load would keep as an owner's edit. Throws UncheckedIOException when it cannot write; the catalog asks only where no file is.