GitHubLoslegen

Die API-Referenz stammt aus den Go-Doc-Kommentaren im Quellcode und ist auf Englisch verfasst.

package datatablewatch

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

Übersicht

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

Funktionen

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).