GitHubCommencer

La référence API provient des commentaires de documentation Go du code source et est rédigée en anglais.

package datatablewatch

import "github.com/nsgo-dev/game/pkg/datatable/datatablewatch"

Vue d’ensemble

Package datatablewatch adds hot reload to datatable.Table through a tooling/hotreload.Watcher.

It lives outside datatable so a headless build, such as a dedicated server, imports datatable without NSGo: only the game client links the watcher.

Index

Fonctions

func Watch[T any](tbl *datatable.Table[T], watcher *hotreload.Watcher, onReload func([]T))

Watch registers tbl's file with watcher and invokes onReload with the updated rows on the engine goroutine whenever a valid edit is saved.

Invalid edits keep the previous valid rows intact and record the error in tbl.LastError.

func WatchWithError[T any](tbl *datatable.Table[T], watcher *hotreload.Watcher, onReload func([]T, error))

WatchWithError registers tbl's file with watcher and invokes onReload with either the new rows (err == nil) or the parse error (rows == previous valid rows).