luago

package module
v0.0.0-...-c8e66c0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: MIT Imports: 5 Imported by: 0

README

luago

介绍

a simple go binding for lua5.2,and allow lua use go functions。 简单的lua5.2的go语言绑定。且支持lua和go的相互调用。 支持打印输出错误信息。

luago

A lua wrapper for golang.

简介

一个采用cgo模式集成入lua 5.2.2的小模块。基本导出了所有的lua函数,在原来的基础上加上了导入go函数的功能,你可以在lua中很简单的调用注册过的go函数。 forked form github.com/sryanyuan/luago

Details

This project implement a wrapper for lua 5.2.2 using cgo.It just export almost all functions from lua, and support pushing your own go functions to the lua VM.So you can invoke your go functions in your lua script easily.

Usage

package main

import (
	"strconv"

	"gitee.com/yyz116/luago"
)

func export(L luago.Lua_Handle) int {
	//	get args from lua
	num := int(luago.Lua_tonumber(L, -2))
	str := luago.Lua_tostring(L, -1)

	//	push value to lua
	val := str + strconv.Itoa(num)
	luago.Lua_pushstring(L, val)
	return 1
}

func main() {
	L := luago.LuaGo_newState()
	L.OpenStdLibs()

	L.LuaGo_PushGoFunction("export", export)

	//	invoke
	luago.LuaL_dostring(L.GetHandle(), ` 
		local val = export(1, "hello luago")
		print(val)
	`)
}

license

MIT

Documentation

Index

Constants

View Source
const (
	THREAD_NOT_LOADED   = iota // 脚本未载入
	THREAD_LOADED              // 脚本已载入
	THREAD_RUNNING             // 脚本运行中
	THREAD_WAIT_SECONDS        // 脚本等待多少秒
	THREAD_WAIT_FRAMES         // 脚本等待多少帧
	THREAD_ERROR               // 脚本出现错误
	THREAD_DONE                // 脚本执行完毕
)

LuaGo_Thread status

View Source
const LUA_AUTHORS = C.LUA_AUTHORS
View Source
const LUA_BITLIBNAME = C.LUA_BITLIBNAME
View Source
const LUA_COLIBNAME = C.LUA_COLIBNAME
View Source
const LUA_COPYRIGHT = LUA_RELEASE + "  Copyright (C) 1994-2013 Lua.org, PUC-Rio"
View Source
const LUA_DBLIBNAME = C.LUA_DBLIBNAME
View Source
const LUA_DIRSEP = C.LUA_DIRSEP
View Source
const LUA_ENV = C.LUA_ENV
View Source
const LUA_ERRERR = C.LUA_ERRERR
View Source
const LUA_ERRFILE = C.LUA_ERRFILE

extra error code for `luaL_load'

View Source
const LUA_ERRGCMM = C.LUA_ERRGCMM
View Source
const LUA_ERRMEM = C.LUA_ERRMEM
View Source
const LUA_ERRRUN = C.LUA_ERRRUN
View Source
const LUA_ERRSYNTAX = C.LUA_ERRSYNTAX
View Source
const LUA_FILEHANDLE = C.LUA_FILEHANDLE
View Source
const LUA_GCCOLLECT = C.LUA_GCCOLLECT
View Source
const LUA_GCCOUNT = C.LUA_GCCOUNT
View Source
const LUA_GCCOUNTB = C.LUA_GCCOUNTB
View Source
const LUA_GCGEN = C.LUA_GCGEN
View Source
const LUA_GCINC = C.LUA_GCINC
View Source
const LUA_GCISRUNNING = C.LUA_GCISRUNNING
View Source
const LUA_GCRESTART = C.LUA_GCRESTART
View Source
const LUA_GCSETMAJORINC = C.LUA_GCSETMAJORINC
View Source
const LUA_GCSETPAUSE = C.LUA_GCSETPAUSE
View Source
const LUA_GCSETSTEPMUL = C.LUA_GCSETSTEPMUL
View Source
const LUA_GCSTEP = C.LUA_GCSTEP
View Source
const LUA_GCSTOP = C.LUA_GCSTOP
View Source
const LUA_HOOKCALL = C.LUA_HOOKCALL

** Event codes

View Source
const LUA_HOOKCOUNT = C.LUA_HOOKCOUNT
View Source
const LUA_HOOKLINE = C.LUA_HOOKLINE
View Source
const LUA_HOOKRET = C.LUA_HOOKRET
View Source
const LUA_HOOKTAILCALL = C.LUA_HOOKTAILCALL
View Source
const LUA_IDSIZE = C.LUA_IDSIZE
View Source
const LUA_IOLIBNAME = C.LUA_IOLIBNAME
View Source
const LUA_LOADLIBNAME = C.LUA_LOADLIBNAME
View Source
const LUA_MASKCALL = C.LUA_MASKCALL

** Event masks

View Source
const LUA_MASKCOUNT = C.LUA_MASKCOUNT
View Source
const LUA_MASKLINE = C.LUA_MASKLINE
View Source
const LUA_MASKRET = C.LUA_MASKRET
View Source
const LUA_MATHLIBNAME = C.LUA_MATHLIBNAME
View Source
const LUA_MINSTACK = C.LUA_MINSTACK

minimum Lua stack available to a C function

View Source
const LUA_MULTRET = C.LUA_MULTRET

option for multiple returns in 'lua_pcall' and 'lua_call'

View Source
const LUA_NOREF = C.LUA_NOREF

pre-defined references

View Source
const LUA_NUMBER_FMT = C.LUA_NUMBER_FMT
View Source
const LUA_NUMBER_SCAN = C.LUA_NUMBER_SCAN
View Source
const LUA_NUMTAGS = C.LUA_NUMTAGS
View Source
const LUA_OK = C.LUA_OK

thread status

View Source
const LUA_OPADD = C.LUA_OPADD
View Source
const LUA_OPDIV = C.LUA_OPDIV
View Source
const LUA_OPEQ = C.LUA_OPEQ
View Source
const LUA_OPLE = C.LUA_OPLE
View Source
const LUA_OPLT = C.LUA_OPLT
View Source
const LUA_OPMOD = C.LUA_OPMOD
View Source
const LUA_OPMUL = C.LUA_OPMUL
View Source
const LUA_OPPOW = C.LUA_OPPOW
View Source
const LUA_OPSUB = C.LUA_OPSUB
View Source
const LUA_OPUNM = C.LUA_OPUNM
View Source
const LUA_OSLIBNAME = C.LUA_OSLIBNAME
View Source
const LUA_REFNIL = C.LUA_REFNIL
View Source
const LUA_REGISTRYINDEX = C.LUA_REGISTRYINDEX

** pseudo-indices

View Source
const LUA_RELEASE = LUA_VERSION + "." + C.LUA_VERSION_RELEASE
View Source
const LUA_RIDX_GLOBALS = C.LUA_RIDX_GLOBALS
View Source
const LUA_RIDX_LAST = C.LUA_RIDX_LAST
View Source
const LUA_RIDX_MAINTHREAD = C.LUA_RIDX_MAINTHREAD

predefined values in the registry

View Source
const LUA_SIGNATURE = C.LUA_SIGNATURE

mark for precompiled code ('<esc>Lua')

View Source
const LUA_STRLIBNAME = C.LUA_STRLIBNAME
View Source
const LUA_TABLIBNAME = C.LUA_TABLIBNAME
View Source
const LUA_TBOOLEAN = C.LUA_TBOOLEAN
View Source
const LUA_TFUNCTION = C.LUA_TFUNCTION
View Source
const LUA_TLIGHTUSERDATA = C.LUA_TLIGHTUSERDATA
View Source
const LUA_TNIL = C.LUA_TNIL
View Source
const LUA_TNONE = C.LUA_TNONE

** basic types

View Source
const LUA_TNUMBER = C.LUA_TNUMBER
View Source
const LUA_TSTRING = C.LUA_TSTRING
View Source
const LUA_TTABLE = C.LUA_TTABLE
View Source
const LUA_TTHREAD = C.LUA_TTHREAD
View Source
const LUA_TUSERDATA = C.LUA_TUSERDATA
View Source
const LUA_VERSION = "Lua " + C.LUA_VERSION_MAJOR + "." + C.LUA_VERSION_MINOR
View Source
const LUA_VERSION_MAJOR = C.LUA_VERSION_MAJOR
View Source
const LUA_VERSION_MINOR = C.LUA_VERSION_MINOR
View Source
const LUA_VERSION_NUM = C.LUA_VERSION_NUM
View Source
const LUA_VERSION_RELEASE = C.LUA_VERSION_RELEASE
View Source
const LUA_YIELD = C.LUA_YIELD

Variables

View Source
var Lua_ident = C.lua_ident

** RCS ident string

Functions

func LuaGoH_FetchParams

func LuaGoH_FetchParams(L Lua_Handle, ignore_nonexistent_field bool, args ...interface{}) bool

func LuaGoH_FetchValue

func LuaGoH_FetchValue(L Lua_Handle, value *reflect.Value, ignore_nonexistent_field bool) bool

func LuaGoH_FetchVariable

func LuaGoH_FetchVariable(L Lua_Handle, value interface{}, ignore_nonexistent_field bool) bool

func LuaGoH_GetGlobal

func LuaGoH_GetGlobal(l Lua_Handle, varname string) bool

varname -> a.b.c

func LuaGoH_GetRef

func LuaGoH_GetRef(l Lua_Handle, var_ref LuaGo_Ref) bool

func LuaGoH_InvokeFunction

func LuaGoH_InvokeFunction(l Lua_Handle, nargs int, nresults int, err_code *int, err_msg *string) bool

func LuaGoH_PushValue

func LuaGoH_PushValue(L Lua_Handle, value *reflect.Value) bool

func LuaGoH_PushVariable

func LuaGoH_PushVariable(L Lua_Handle, value interface{}) bool

func LuaGoH_SetGlobal

func LuaGoH_SetGlobal(l Lua_Handle, varname string) bool

func LuaGo_stackDump

func LuaGo_stackDump(L Lua_Handle)

func LuaL_addchar

func LuaL_addchar(B *LuaL_Buffer, c byte)

func LuaL_addlstring

func LuaL_addlstring(B *LuaL_Buffer, s string, l uint)

func LuaL_addsize

func LuaL_addsize(B *LuaL_Buffer, s uint)

func LuaL_addstring

func LuaL_addstring(B *LuaL_Buffer, s string)

func LuaL_addvalue

func LuaL_addvalue(B *LuaL_Buffer)

func LuaL_argcheck

func LuaL_argcheck(L Lua_Handle, cond bool, numarg int, extramsg string)

func LuaL_argerror

func LuaL_argerror(L Lua_Handle, numarg int, extramsg string) int

func LuaL_buffinit

func LuaL_buffinit(L Lua_Handle, B *LuaL_Buffer)

func LuaL_buffinitsize

func LuaL_buffinitsize(L Lua_Handle, B *LuaL_Buffer, sz uint) unsafe.Pointer

func LuaL_callmeta

func LuaL_callmeta(L Lua_Handle, obj int, e string) int

func LuaL_checkany

func LuaL_checkany(L Lua_Handle, narg int)

func LuaL_checkint

func LuaL_checkint(L Lua_Handle, numArg int) int

func LuaL_checklong

func LuaL_checklong(L Lua_Handle, numArg int) int32

func LuaL_checklstring

func LuaL_checklstring(L Lua_Handle, numArg int, l *uint) string

func LuaL_checkoption

func LuaL_checkoption(L Lua_Handle, narg int, def string, lst []string) int

func LuaL_checkstack

func LuaL_checkstack(L Lua_Handle, sz int, msg string)

func LuaL_checkstring

func LuaL_checkstring(L Lua_Handle, numArg int) string

func LuaL_checktype

func LuaL_checktype(L Lua_Handle, narg int, t int)

func LuaL_checkudata

func LuaL_checkudata(L Lua_Handle, ud int, tname string) unsafe.Pointer

func LuaL_checkversion

func LuaL_checkversion(L Lua_Handle)

func LuaL_checkversion_

func LuaL_checkversion_(L Lua_Handle, ver Lua_Number)

func LuaL_dofile

func LuaL_dofile(L Lua_Handle, fn string) int

func LuaL_dostring

func LuaL_dostring(L Lua_Handle, s string) int

func LuaL_execresult

func LuaL_execresult(L Lua_Handle, stat int) int

func LuaL_fileresult

func LuaL_fileresult(L Lua_Handle, stat int, fname string) int

func LuaL_getmetafield

func LuaL_getmetafield(L Lua_Handle, obj int, e string) int

func LuaL_getmetatable

func LuaL_getmetatable(L Lua_Handle, name string)

func LuaL_getsubtable

func LuaL_getsubtable(L Lua_Handle, idx int, fname string) int

func LuaL_gsub

func LuaL_gsub(L Lua_Handle, s string, p string, r string) string

func LuaL_len

func LuaL_len(L Lua_Handle, idx int) int

func LuaL_loadbuffer

func LuaL_loadbuffer(L Lua_Handle, buff unsafe.Pointer, sz uint, name string) int

func LuaL_loadbufferx

func LuaL_loadbufferx(L Lua_Handle, buff unsafe.Pointer, sz uint, name string, mode string) int

func LuaL_loadfile

func LuaL_loadfile(L Lua_Handle, filename string) int

func LuaL_loadfilex

func LuaL_loadfilex(L Lua_Handle, filename string, mode string) int

func LuaL_loadstring

func LuaL_loadstring(L Lua_Handle, s string) int

func LuaL_newlib

func LuaL_newlib(L Lua_Handle, lst *LuaL_Reg)

func LuaL_newlibtable

func LuaL_newlibtable(L Lua_Handle, lst *LuaL_Reg)

func LuaL_newmetatable

func LuaL_newmetatable(L Lua_Handle, tname string) int

func LuaL_openlibs

func LuaL_openlibs(L Lua_Handle)

open all previous libraries

func LuaL_optint

func LuaL_optint(L Lua_Handle, numArg int, def int) int

func LuaL_optlong

func LuaL_optlong(L Lua_Handle, numArg int, def int32) int32

func LuaL_optlstring

func LuaL_optlstring(L Lua_Handle, numArg int, def string, l *uint) string

func LuaL_optstring

func LuaL_optstring(L Lua_Handle, numArg int, def string) string

func LuaL_prepbuffer

func LuaL_prepbuffer(B *LuaL_Buffer)

func LuaL_prepbuffsize

func LuaL_prepbuffsize(B *LuaL_Buffer, sz uint) unsafe.Pointer

func LuaL_pushresult

func LuaL_pushresult(B *LuaL_Buffer)

func LuaL_pushresultsize

func LuaL_pushresultsize(B *LuaL_Buffer, sz uint)

func LuaL_ref

func LuaL_ref(L Lua_Handle, t int) int

func LuaL_requiref

func LuaL_requiref(L Lua_Handle, modname string, openf Lua_CFunction, glb int)

func LuaL_setfuncs

func LuaL_setfuncs(L Lua_Handle, lst *LuaL_Reg, nup int)

func LuaL_setmetatable

func LuaL_setmetatable(L Lua_Handle, tname string)

func LuaL_testudata

func LuaL_testudata(L Lua_Handle, ud int, tname string) unsafe.Pointer

func LuaL_tolstring

func LuaL_tolstring(L Lua_Handle, idx int, len *uint) string

func LuaL_traceback

func LuaL_traceback(L Lua_Handle, L1 Lua_Handle, msg string, level int)

func LuaL_typename

func LuaL_typename(L Lua_Handle, idx int) string

func LuaL_unref

func LuaL_unref(L Lua_Handle, t int, ref int)

func LuaL_where

func LuaL_where(L Lua_Handle, lvl int)

func Lua_absindex

func Lua_absindex(L Lua_Handle, idx int) int

** basic stack manipulation

func Lua_arith

func Lua_arith(L Lua_Handle, op int)

func Lua_call

func Lua_call(L Lua_Handle, nargs int, nresults int)

func Lua_callk

func Lua_callk(L Lua_Handle, nargs int, nresults int, ctx int, k Lua_CFunction)

** 'load' and 'call' functions (load and run Lua code)

func Lua_checkstack

func Lua_checkstack(L Lua_Handle, sz int) bool

func Lua_close

func Lua_close(L Lua_Handle)

func Lua_compare

func Lua_compare(L Lua_Handle, idx1 int, idx2 int, op int) int

func Lua_concat

func Lua_concat(L Lua_Handle, n int)

func Lua_copy

func Lua_copy(L Lua_Handle, fromidx int, toidx int)

func Lua_createtable

func Lua_createtable(L Lua_Handle, narr int, nrec int)

func Lua_dump

func Lua_dump(L Lua_Handle, writer Lua_Writer, data unsafe.Pointer) int

func Lua_error

func Lua_error(L Lua_Handle) int

func Lua_gc

func Lua_gc(L Lua_Handle, what int, data int) int

func Lua_getctx

func Lua_getctx(L Lua_Handle, ctx *int) int

func Lua_getfield

func Lua_getfield(L Lua_Handle, idx int, k string)

func Lua_getglobal

func Lua_getglobal(L Lua_Handle, varname string)

** get functions (Lua -> stack)

func Lua_getmetatable

func Lua_getmetatable(L Lua_Handle, objindex int) bool

func Lua_gettable

func Lua_gettable(L Lua_Handle, idx int)

func Lua_gettop

func Lua_gettop(L Lua_Handle) int

func Lua_getuservalue

func Lua_getuservalue(L Lua_Handle, idx int)

func Lua_insert

func Lua_insert(L Lua_Handle, idx int)

func Lua_isboolean

func Lua_isboolean(L Lua_Handle, n int) bool

func Lua_iscfunction

func Lua_iscfunction(L Lua_Handle, idx int) bool

func Lua_isfunction

func Lua_isfunction(L Lua_Handle, n int) bool

func Lua_islightuserdata

func Lua_islightuserdata(L Lua_Handle, n int) bool

func Lua_isnil

func Lua_isnil(L Lua_Handle, n int) bool

func Lua_isnone

func Lua_isnone(L Lua_Handle, n int) bool

func Lua_isnoneornil

func Lua_isnoneornil(L Lua_Handle, n int) bool

func Lua_isnumber

func Lua_isnumber(L Lua_Handle, idx int) bool

func Lua_isstring

func Lua_isstring(L Lua_Handle, idx int) bool

func Lua_istable

func Lua_istable(L Lua_Handle, n int) bool

func Lua_isthread

func Lua_isthread(L Lua_Handle, n int) bool

func Lua_isuserdata

func Lua_isuserdata(L Lua_Handle, idx int) bool

func Lua_len

func Lua_len(L Lua_Handle, idx int)

func Lua_load

func Lua_load(L Lua_Handle, reader Lua_Reader, dt unsafe.Pointer, chunkname string, mode string) int

func Lua_newtable

func Lua_newtable(L Lua_Handle)

func Lua_newuserdata

func Lua_newuserdata(L Lua_Handle, sz uint) unsafe.Pointer

func Lua_next

func Lua_next(L Lua_Handle, idx int) int

func Lua_pcall

func Lua_pcall(L Lua_Handle, nargs int, nresults int, errfunc int) int

func Lua_pcallk

func Lua_pcallk(L Lua_Handle, nargs int, nresults int, errfunc int, ctx int, k Lua_CFunction) int

func Lua_pop

func Lua_pop(L Lua_Handle, n int)

func Lua_pushboolean

func Lua_pushboolean(L Lua_Handle, b bool)

func Lua_pushcclosure

func Lua_pushcclosure(L Lua_Handle, fn Lua_CFunction, n int)

TODO: LUA_API const char *(lua_pushvfstring) (L Lua_Handle, const char *fmt, va_list argp); TODO: LUA_API const char *(lua_pushfstring) (L Lua_Handle, const char *fmt, ...);

func Lua_pushcfunction

func Lua_pushcfunction(L Lua_Handle, fn Lua_CFunction)

func Lua_pushglobaltable

func Lua_pushglobaltable(L Lua_Handle)

TODO: #define lua_pushliteral (L Lua_Handle, s string) lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)

func Lua_pushinteger

func Lua_pushinteger(L Lua_Handle, n Lua_Integer)

func Lua_pushlightuserdata

func Lua_pushlightuserdata(L Lua_Handle, p unsafe.Pointer)

func Lua_pushlstring

func Lua_pushlstring(L Lua_Handle, s unsafe.Pointer, l uint)

func Lua_pushnil

func Lua_pushnil(L Lua_Handle)

** push functions (C -> stack)

func Lua_pushnumber

func Lua_pushnumber(L Lua_Handle, n Lua_Number)

func Lua_pushstring

func Lua_pushstring(L Lua_Handle, s string) string

func Lua_pushthread

func Lua_pushthread(L Lua_Handle) bool

func Lua_pushunsigned

func Lua_pushunsigned(L Lua_Handle, n Lua_Unsigned)

func Lua_pushvalue

func Lua_pushvalue(L Lua_Handle, idx int)

func Lua_rawequal

func Lua_rawequal(L Lua_Handle, idx1 int, idx2 int) bool

func Lua_rawget

func Lua_rawget(L Lua_Handle, idx int)

func Lua_rawgeti

func Lua_rawgeti(L Lua_Handle, idx int, n int)

func Lua_rawgetp

func Lua_rawgetp(L Lua_Handle, idx int, p unsafe.Pointer)

func Lua_rawlen

func Lua_rawlen(L Lua_Handle, idx int) uint

func Lua_rawset

func Lua_rawset(L Lua_Handle, idx int)

func Lua_rawseti

func Lua_rawseti(L Lua_Handle, idx int, n int)

func Lua_rawsetp

func Lua_rawsetp(L Lua_Handle, idx int, p unsafe.Pointer)

func Lua_register

func Lua_register(L Lua_Handle, varname string, fn Lua_CFunction)

func Lua_remove

func Lua_remove(L Lua_Handle, idx int)

func Lua_replace

func Lua_replace(L Lua_Handle, idx int)

func Lua_resume

func Lua_resume(L Lua_Handle, from Lua_Handle, narg int) int

func Lua_setallocf

func Lua_setallocf(L Lua_Handle, f Lua_Alloc, ud unsafe.Pointer)

func Lua_setfield

func Lua_setfield(L Lua_Handle, idx int, k string)

func Lua_setglobal

func Lua_setglobal(L Lua_Handle, varname string)

** set functions (stack -> Lua)

func Lua_setmetatable

func Lua_setmetatable(L Lua_Handle, objindex int) bool

func Lua_settable

func Lua_settable(L Lua_Handle, idx int)

func Lua_settop

func Lua_settop(L Lua_Handle, idx int)

func Lua_setuservalue

func Lua_setuservalue(L Lua_Handle, idx int)

func Lua_status

func Lua_status(L Lua_Handle) int

func Lua_toboolean

func Lua_toboolean(L Lua_Handle, idx int) bool

func Lua_tolstring

func Lua_tolstring(L Lua_Handle, idx int, len *uint) string

func Lua_tolstringbytes

func Lua_tolstringbytes(L Lua_Handle, idx int) []byte

func Lua_topointer

func Lua_topointer(L Lua_Handle, idx int) unsafe.Pointer

func Lua_tostring

func Lua_tostring(L Lua_Handle, i int) string

func Lua_touserdata

func Lua_touserdata(L Lua_Handle, idx int) unsafe.Pointer

func Lua_type

func Lua_type(L Lua_Handle, idx int) int

func Lua_typename

func Lua_typename(L Lua_Handle, tp int) string

func Lua_upvalueindex

func Lua_upvalueindex(i int) int

func Lua_xmove

func Lua_xmove(from Lua_Handle, to Lua_Handle, n int)

func Lua_yield

func Lua_yield(L Lua_Handle, nresults int) int

func Lua_yieldk

func Lua_yieldk(L Lua_Handle, nresults int, ctx int, k Lua_CFunction) int

** coroutine functions

func Luaopen_base

func Luaopen_base(L Lua_Handle) int

func Luaopen_bit32

func Luaopen_bit32(L Lua_Handle) int

func Luaopen_coroutine

func Luaopen_coroutine(L Lua_Handle) int

func Luaopen_debug

func Luaopen_debug(L Lua_Handle) int

func Luaopen_io

func Luaopen_io(L Lua_Handle) int

func Luaopen_math

func Luaopen_math(L Lua_Handle) int

func Luaopen_os

func Luaopen_os(L Lua_Handle) int

func Luaopen_package

func Luaopen_package(L Lua_Handle) int

func Luaopen_string

func Luaopen_string(L Lua_Handle) int

func Luaopen_table

func Luaopen_table(L Lua_Handle) int

Types

type LUA_INT32

type LUA_INT32 C.LUA_INT32

type LUA_INTEGER

type LUA_INTEGER C.LUA_INTEGER

type LUA_NUMBER

type LUA_NUMBER C.LUA_NUMBER

type LUA_UNSIGNED

type LUA_UNSIGNED C.LUA_UNSIGNED

type LuaGo_Function

type LuaGo_Function func(L Lua_Handle) int

type LuaGo_Int

type LuaGo_Int C.int

type LuaGo_Ref

type LuaGo_Ref int

type LuaGo_ResultSum

type LuaGo_ResultSum C.int

type LuaGo_Script

type LuaGo_Script struct {
	LuaGo_ScriptBase
}

simple impls.

func CreateLuaScript

func CreateLuaScript() *LuaGo_Script

func (*LuaGo_Script) Create

func (s *LuaGo_Script) Create()

func (*LuaGo_Script) Destroy

func (s *LuaGo_Script) Destroy()

type LuaGo_ScriptBase

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

LuaGo_ScriptBase

func (*LuaGo_ScriptBase) Call

func (s *LuaGo_ScriptBase) Call(func_name string, args ...interface{}) bool

func (*LuaGo_ScriptBase) GetErrorMessage

func (s *LuaGo_ScriptBase) GetErrorMessage() string

called must after dostring / dofile

func (*LuaGo_ScriptBase) GetHandle

func (s *LuaGo_ScriptBase) GetHandle() Lua_Handle

func (*LuaGo_ScriptBase) GetObject

func (s *LuaGo_ScriptBase) GetObject(var_name string, value interface{}, ignore_nonexistent_field bool) bool

func (*LuaGo_ScriptBase) GetRef

func (s *LuaGo_ScriptBase) GetRef(var_name string, pref *LuaGo_Ref) bool

func (*LuaGo_ScriptBase) GetVar

func (s *LuaGo_ScriptBase) GetVar(var_name string, value interface{}) bool

func (*LuaGo_ScriptBase) HasRef

func (s *LuaGo_ScriptBase) HasRef(ref LuaGo_Ref) bool

func (*LuaGo_ScriptBase) HasVar

func (s *LuaGo_ScriptBase) HasVar(var_name string) bool

func (*LuaGo_ScriptBase) Invoke

func (s *LuaGo_ScriptBase) Invoke(ret_value interface{}, func_name string, args ...interface{}) bool

func (*LuaGo_ScriptBase) LoadRef

func (s *LuaGo_ScriptBase) LoadRef(ref LuaGo_Ref) bool

func (*LuaGo_ScriptBase) OpenStdLibs

func (s *LuaGo_ScriptBase) OpenStdLibs()

func (*LuaGo_ScriptBase) RemoveRef

func (s *LuaGo_ScriptBase) RemoveRef(ref LuaGo_Ref) bool

func (*LuaGo_ScriptBase) RemoveVar

func (s *LuaGo_ScriptBase) RemoveVar(var_name string)

func (*LuaGo_ScriptBase) RunBuffer

func (s *LuaGo_ScriptBase) RunBuffer(buffer unsafe.Pointer, size uint) bool

func (*LuaGo_ScriptBase) RunFile

func (s *LuaGo_ScriptBase) RunFile(file string) bool

func (*LuaGo_ScriptBase) RunString

func (s *LuaGo_ScriptBase) RunString(code string) bool

func (*LuaGo_ScriptBase) SetHandle

func (s *LuaGo_ScriptBase) SetHandle(l Lua_Handle)

func (*LuaGo_ScriptBase) SetObject

func (s *LuaGo_ScriptBase) SetObject(var_name string, value interface{}, keep_nonexistent_field bool) bool

func (*LuaGo_ScriptBase) SetVar

func (s *LuaGo_ScriptBase) SetVar(var_name string, value interface{}) bool

type LuaGo_State

type LuaGo_State struct {
	//	base struct
	LuaGo_Script
	// contains filtered or unexported fields
}

func LuaGo_newState

func LuaGo_newState() *LuaGo_State

func (*LuaGo_State) LuaGo_AddSearchPath

func (this *LuaGo_State) LuaGo_AddSearchPath(_path string, _tip int)

增加lua搜索路径

func (*LuaGo_State) LuaGo_OpenInvokeCompenent

func (this *LuaGo_State) LuaGo_OpenInvokeCompenent()

开启gofunction注册支持

func (*LuaGo_State) LuaGo_PopGoFunction

func (this *LuaGo_State) LuaGo_PopGoFunction(_name string)

func (*LuaGo_State) LuaGo_PushGoFunction

func (this *LuaGo_State) LuaGo_PushGoFunction(_name string, _func LuaGo_Function) int

压入gofunction

func (*LuaGo_State) LuaGo_SafeCall

func (this *LuaGo_State) LuaGo_SafeCall(argnum int, removeret bool) (int, error)

只支持返回单返回值:number or boolean , 其余自己操作lua_state获取 removeret : 自动pop返回值,假设返回值个数为0,传入false

func (*LuaGo_State) LuaGo_SafeDoFile

func (this *LuaGo_State) LuaGo_SafeDoFile(_name string) error

type LuaGo_Thread

type LuaGo_Thread struct {
	LuaGo_ScriptBase
	// contains filtered or unexported fields
}

LuaGo_Thread

func (*LuaGo_Thread) AbortWait

func (t *LuaGo_Thread) AbortWait()

func (*LuaGo_Thread) GetAutoDelete

func (t *LuaGo_Thread) GetAutoDelete() bool

func (*LuaGo_Thread) GetMgr

func (t *LuaGo_Thread) GetMgr() *LuaGo_ThreadMgr

func (*LuaGo_Thread) GetStatus

func (t *LuaGo_Thread) GetStatus() int

func (*LuaGo_Thread) RunBuffer

func (t *LuaGo_Thread) RunBuffer(buffer unsafe.Pointer, size uint) bool

func (*LuaGo_Thread) RunFile

func (t *LuaGo_Thread) RunFile(file string) bool

func (*LuaGo_Thread) RunString

func (t *LuaGo_Thread) RunString(code string) bool

func (*LuaGo_Thread) SetAutoDelete

func (t *LuaGo_Thread) SetAutoDelete(bAutoDelete bool)

type LuaGo_ThreadMgr

type LuaGo_ThreadMgr struct {
	LuaGo_ScriptBase
	// contains filtered or unexported fields
}

LuaGo_ThreadMgr

func CreateLuaThreadMgr

func CreateLuaThreadMgr() *LuaGo_ThreadMgr

func (*LuaGo_ThreadMgr) Create

func (m *LuaGo_ThreadMgr) Create()

func (*LuaGo_ThreadMgr) CreateThread

func (m *LuaGo_ThreadMgr) CreateThread(bAutoDelete bool) *LuaGo_Thread

func (*LuaGo_ThreadMgr) Destroy

func (m *LuaGo_ThreadMgr) Destroy()

func (*LuaGo_ThreadMgr) DestroyThread

func (m *LuaGo_ThreadMgr) DestroyThread(t *LuaGo_Thread)

func (*LuaGo_ThreadMgr) GetThreadSum

func (m *LuaGo_ThreadMgr) GetThreadSum() int

func (*LuaGo_ThreadMgr) IsValidThread

func (m *LuaGo_ThreadMgr) IsValidThread(t *LuaGo_Thread) bool

func (*LuaGo_ThreadMgr) OpenScriptLib

func (m *LuaGo_ThreadMgr) OpenScriptLib()

func (*LuaGo_ThreadMgr) Update

func (m *LuaGo_ThreadMgr) Update(dt float32)

type LuaL_Buffer

type LuaL_Buffer C.luaL_Buffer

type LuaL_Reg

type LuaL_Reg C.luaL_Reg

func LuaGo_RegPtr

func LuaGo_RegPtr(r unsafe.Pointer) *LuaL_Reg

type LuaL_Stream

type LuaL_Stream C.luaL_Stream

type Lua_Alloc

type Lua_Alloc C.lua_Alloc

** prototype for memory-allocation functions

func Lua_getallocf

func Lua_getallocf(L Lua_Handle, ud *unsafe.Pointer) Lua_Alloc

type Lua_CFunction

type Lua_CFunction C.lua_CFunction

func Lua_atpanic

func Lua_atpanic(L Lua_Handle, panicf Lua_CFunction) Lua_CFunction

func Lua_tocfunction

func Lua_tocfunction(L Lua_Handle, idx int) Lua_CFunction

type Lua_Debug

type Lua_Debug C.lua_Debug

type Lua_Handle

type Lua_Handle *C.lua_State

func LuaGo_Handle

func LuaGo_Handle(l unsafe.Pointer) Lua_Handle

func LuaL_newstate

func LuaL_newstate() Lua_Handle

func Lua_newstate

func Lua_newstate(f Lua_Alloc, ud unsafe.Pointer) Lua_Handle

** state manipulation

func Lua_newthread

func Lua_newthread(L Lua_Handle) Lua_Handle

func Lua_tothread

func Lua_tothread(L Lua_Handle, idx int) Lua_Handle

type Lua_Hook

type Lua_Hook C.lua_Hook

type Lua_Integer

type Lua_Integer C.lua_Integer

type for integer functions

func LuaL_checkinteger

func LuaL_checkinteger(L Lua_Handle, numArg int) Lua_Integer

func LuaL_optinteger

func LuaL_optinteger(L Lua_Handle, nArg int, def Lua_Integer) Lua_Integer

func Lua_tointeger

func Lua_tointeger(L Lua_Handle, idx int) Lua_Integer

func Lua_tointegerx

func Lua_tointegerx(L Lua_Handle, idx int, isnum *bool) Lua_Integer

type Lua_Number

type Lua_Number C.lua_Number

type of numbers in Lua

func LuaL_checknumber

func LuaL_checknumber(L Lua_Handle, numArg int) Lua_Number

func LuaL_optnumber

func LuaL_optnumber(L Lua_Handle, nArg int, def Lua_Number) Lua_Number

func Lua_tonumber

func Lua_tonumber(L Lua_Handle, idx int) Lua_Number

func Lua_tonumberx

func Lua_tonumberx(L Lua_Handle, idx int, isnum *bool) Lua_Number

func Lua_version

func Lua_version(L Lua_Handle) Lua_Number

type Lua_Reader

type Lua_Reader C.lua_Reader

** functions that read/write blocks when loading/dumping Lua chunks

type Lua_Unsigned

type Lua_Unsigned C.lua_Unsigned

unsigned integer type

func LuaL_checkunsigned

func LuaL_checkunsigned(L Lua_Handle, numArg int) Lua_Unsigned

func LuaL_optunsigned

func LuaL_optunsigned(L Lua_Handle, numArg int, def Lua_Unsigned) Lua_Unsigned

func Lua_tounsigned

func Lua_tounsigned(L Lua_Handle, idx int) Lua_Unsigned

func Lua_tounsignedx

func Lua_tounsignedx(L Lua_Handle, idx int, isnum *bool) Lua_Unsigned

type Lua_Writer

type Lua_Writer C.lua_Reader

Jump to

Keyboard shortcuts

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