Move RnD sample programs to examples dir, rename test_data to example_data, add stubs for server and client

This commit is contained in:
eleksir
2025-10-27 18:14:28 +03:00
parent f8a41a8cb4
commit b0c28ef87f
54 changed files with 10744 additions and 24 deletions

View File

@@ -0,0 +1,37 @@
package main
import (
"doll/internal/log"
"os"
lua "github.com/yuin/gopher-lua"
)
func main() {
file := "example_data/02-test.lua"
log.Init("info", os.Stderr)
L := lua.NewState()
defer L.Close()
// Load the Lua script file.
log.Infof("Loading %s", file)
// We can execute script directly via L.DoFile("./example_data/02-test.lua") but in practice we'll get scripts as
// strings - snippets from templates - so, testing/checking how it works is not use for project.
luaCode, err := os.ReadFile(file)
if err != nil {
log.Errorf("Error reading Lua file %s: %s", file, err)
os.Exit(1)
}
if err := L.DoString(string(luaCode)); err != nil {
log.Errorf("Error evaluating Lua code: %s", err)
os.Exit(1)
}
}
/* vim: set ft=go noet ai ts=4 sw=4 sts=4: */