luastate

package
v1.17.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package luastate wraps lua/pool with a Borrow/Return API and scoped helpers. The underlying pool package stays exported for external users of algernon as a library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool wraps lua/pool.LStatePool with a Borrow/Return discipline

func New

func New() *Pool

New returns a new Pool

func (*Pool) Borrow

func (p *Pool) Borrow() *lua.LState

Borrow takes a Lua state out of the pool, or creates a new one. Pair with Return.

func (*Pool) New

func (p *Pool) New() *lua.LState

New returns a fresh Lua state that is not pooled; the caller is responsible for closing it

func (*Pool) Return

func (p *Pool) Return(L *lua.LState)

Return delivers back a borrowed Lua state

func (*Pool) Shutdown

func (p *Pool) Shutdown()

Shutdown closes all pooled Lua states

func (*Pool) Underlying

func (p *Pool) Underlying() *pool.LStatePool

Underlying returns the wrapped *pool.LStatePool, for interop with not-yet-migrated code

func (*Pool) With

func (p *Pool) With(fn func(L *lua.LState) error) (err error)

With borrows a Lua state, runs fn, and returns the state to the pool even on panic

func (*Pool) WithNew

func (p *Pool) WithNew(fn func(L *lua.LState) error) (err error)

WithNew runs fn with a fresh (non-pooled) Lua state and closes it afterwards, even on panic

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL