luasrc

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package luasrc provides a wrapper for the low-level Lua C API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version added in v0.0.3

func Version() string

Version returns the Lua version string (e.g., "Lua 5.4.8"). This function directly accesses the LUA_RELEASE macro from lua.h via Cgo.

Types

type State

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

State represents a Lua state.

func NewState

func NewState() *State

NewState creates a new Lua state and opens the standard libraries.

func (*State) Close

func (s *State) Close()

Close closes the Lua state.

func (*State) Evaluate

func (s *State) Evaluate(ctx context.Context, code string) ([]any, error)

Evaluate executes a string of Lua code and returns its results.

func (*State) Execute

func (s *State) Execute(ctx context.Context, code string) error

Execute executes a string of Lua code.

func (*State) GetGlobal

func (s *State) GetGlobal(ctx context.Context, name string) any

GetGlobal gets a global variable from the Lua state.

Jump to

Keyboard shortcuts

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