Moonshark/core/runner/context.go
2025-03-15 22:38:03 -05:00

25 lines
557 B
Go

package runner
// Context represents execution context for a Lua script
type Context struct {
// Generic map for any context values (route params, HTTP request info, etc.)
Values map[string]any
}
// NewContext creates a new context with initialized maps
func NewContext() *Context {
return &Context{
Values: make(map[string]any),
}
}
// Set adds a value to the context
func (c *Context) Set(key string, value any) {
c.Values[key] = value
}
// Get retrieves a value from the context
func (c *Context) Get(key string) any {
return c.Values[key]
}