pool

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: BSD-3-Clause Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pool provides functions for managing a pool of Lua state structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LStatePool

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

LStatePool is a pool of Lua states, with a mutex

func New

func New() *LStatePool

New returns a new Lua pool structure

func (*LStatePool) Get

func (pl *LStatePool) Get() *lua.LState

Get borrows an existing Lua state, but sets a new context

func (*LStatePool) New

func (pl *LStatePool) New() *lua.LState

New returns a new Lua state, and sets the context

func (*LStatePool) Put

func (pl *LStatePool) Put(L *lua.LState)

Put delivers back a borrowed Lua state

func (*LStatePool) SetGlobalsScript added in v1.17.10

func (pl *LStatePool) SetGlobalsScript(code []byte)

SetGlobalsScript stores Lua code to run on every freshly-created state in the pool. Used to share globals.lua across the request handlers. Must be called before the pool is used concurrently.

func (*LStatePool) Shutdown

func (pl *LStatePool) Shutdown()

Shutdown can be used then the Lua pool is being shut down

Jump to

Keyboard shortcuts

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