feat: more lua.h bindings & export Go types

This commit is contained in:
Erica Marigold 2024-07-18 19:00:39 +05:30
parent 983b343315
commit 2077850b16
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1
17 changed files with 2713 additions and 112 deletions

16
.vscode/c_cpp_properties.json vendored Normal file
View file

@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/sbin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}

View file

@ -6,7 +6,8 @@
"luaconf.h": "c", "luaconf.h": "c",
"cstdint": "c", "cstdint": "c",
"stdlib.h": "c", "stdlib.h": "c",
"cmath": "cpp" "cmath": "cpp",
"stdio.h": "c"
}, },
"go.toolsEnvVars": { "go.toolsEnvVars": {
"CGO_LDFLAGS_ALLOW":".*" "CGO_LDFLAGS_ALLOW":".*"

BIN
_obj/_cgo_.o Normal file

Binary file not shown.

63
_obj/_cgo_export.c Normal file
View file

@ -0,0 +1,63 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */
#include <stdlib.h>
#include "_cgo_export.h"
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
#pragma GCC diagnostic ignored "-Wunknown-warning-option"
#pragma GCC diagnostic ignored "-Wunaligned-access"
extern void crosscall2(void (*fn)(void *), void *, int, size_t);
extern size_t _cgo_wait_runtime_init_done(void);
extern void _cgo_release_context(size_t);
extern char* _cgo_topofstack(void);
#define CGO_NO_SANITIZE_THREAD
#define _cgo_tsan_acquire()
#define _cgo_tsan_release()
#define _cgo_msan_write(addr, sz)
extern void _cgoexp_4543809e40d5_go_allocf(void *);
CGO_NO_SANITIZE_THREAD
GoUintptr go_allocf(GoUintptr fp, GoUintptr ptr, GoUint64 osize, GoUint64 nsize)
{
size_t _cgo_ctxt = _cgo_wait_runtime_init_done();
typedef struct {
GoUintptr p0;
GoUintptr p1;
GoUint64 p2;
GoUint64 p3;
GoUintptr r0;
} __attribute__((__packed__, __gcc_struct__)) _cgo_argtype;
static _cgo_argtype _cgo_zero;
_cgo_argtype _cgo_a = _cgo_zero;
_cgo_a.p0 = fp;
_cgo_a.p1 = ptr;
_cgo_a.p2 = osize;
_cgo_a.p3 = nsize;
_cgo_tsan_release();
crosscall2(_cgoexp_4543809e40d5_go_allocf, &_cgo_a, 40, _cgo_ctxt);
_cgo_tsan_acquire();
_cgo_release_context(_cgo_ctxt);
return _cgo_a.r0;
}
CGO_NO_SANITIZE_THREAD
void _cgo_4543809e40d5_Cfunc__Cmalloc(void *v) {
struct {
unsigned long long p0;
void *r1;
} __attribute__((__packed__, __gcc_struct__)) *a = v;
void *ret;
_cgo_tsan_acquire();
ret = malloc(a->p0);
if (ret == 0 && a->p0 == 0) {
ret = malloc(1);
}
a->r1 = ret;
_cgo_tsan_release();
}

91
_obj/_cgo_export.h Normal file
View file

@ -0,0 +1,91 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */
/* package internal */
#line 1 "cgo-builtin-export-prolog"
#include <stddef.h>
#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif
#endif
/* Start of preamble from import "C" comments. */
#line 3 "lua.go"
// #cgo LDFLAGS: -L${SRCDIR}/luau/cmake -lLuau.VM -lm -lstdc++
#include "/home/compey/dev/gluau/internal/luau/VM/include/lua.h"
#include "/home/compey/dev/gluau/internal/luau/VM/include/lualib.h"
#include <stdlib.h>
#include "/home/compey/dev/gluau/internal/clua.h"
#line 1 "cgo-generated-wrapper"
/* End of preamble from import "C" comments. */
/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"
#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H
typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif
/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
#endif
/* End of boilerplate cgo prologue. */
#ifdef __cplusplus
extern "C" {
#endif
extern GoUintptr go_allocf(GoUintptr fp, GoUintptr ptr, GoUint64 osize, GoUint64 nsize);
#ifdef __cplusplus
}
#endif

905
_obj/_cgo_gotypes.go Normal file
View file

@ -0,0 +1,905 @@
// Code generated by cmd/cgo; DO NOT EDIT.
package internal
import "unsafe"
import "syscall"
import _cgopackage "runtime/cgo"
type _ _cgopackage.Incomplete
var _ syscall.Errno
func _Cgo_ptr(ptr unsafe.Pointer) unsafe.Pointer { return ptr }
//go:linkname _Cgo_always_false runtime.cgoAlwaysFalse
var _Cgo_always_false bool
//go:linkname _Cgo_use runtime.cgoUse
func _Cgo_use(interface{})
//go:linkname _Cgo_no_callback runtime.cgoNoCallback
func _Cgo_no_callback(bool)
type _Ctype__GoString_ string
type _Ctype_char int8
type _Ctype_double float64
type _Ctype_float float32
type _Ctype_int int32
type _Ctype_intgo = _Ctype_ptrdiff_t
type _Ctype_long int64
type _Ctype_lua_CFunction *[0]byte
type _Ctype_lua_Continuation *[0]byte
type _Ctype_lua_Integer = _Ctype_int
type _Ctype_lua_Number = _Ctype_double
type _Ctype_lua_State = _Ctype_struct_lua_State
type _Ctype_lua_Unsigned = _Ctype_uint
type _Ctype_ptrdiff_t = _Ctype_long
type _Ctype_size_t = _Ctype_ulong
type _Ctype_struct_lua_State _cgopackage.Incomplete
type _Ctype_uint uint32
type _Ctype_ulong uint64
type _Ctype_void [0]byte
//go:linkname _cgo_runtime_cgocall runtime.cgocall
func _cgo_runtime_cgocall(unsafe.Pointer, uintptr) int32
//go:linkname _cgoCheckPointer runtime.cgoCheckPointer
//go:noescape
func _cgoCheckPointer(interface{}, interface{})
//go:linkname _cgoCheckResult runtime.cgoCheckResult
//go:noescape
func _cgoCheckResult(interface{})
// CString converts the Go string s to a C string.
//
// The C string is allocated in the C heap using malloc.
// It is the caller's responsibility to arrange for it to be
// freed, such as by calling C.free (be sure to include stdlib.h
// if C.free is needed).
func _Cfunc_CString(s string) *_Ctype_char {
if len(s)+1 <= 0 {
panic("string too large")
}
p := _cgo_cmalloc(uint64(len(s)+1))
sliceHeader := struct {
p unsafe.Pointer
len int
cap int
}{p, len(s)+1, len(s)+1}
b := *(*[]byte)(unsafe.Pointer(&sliceHeader))
copy(b, s)
b[len(s)] = 0
return (*_Ctype_char)(p)
}
//go:linkname _cgo_runtime_gostring runtime.gostring
func _cgo_runtime_gostring(*_Ctype_char) string
// GoString converts the C string p into a Go string.
func _Cfunc_GoString(p *_Ctype_char) string {
return _cgo_runtime_gostring(p)
}
//go:cgo_import_static _cgo_4543809e40d5_Cmacro_NULL
//go:linkname __cgofn__cgo_4543809e40d5_Cmacro_NULL _cgo_4543809e40d5_Cmacro_NULL
var __cgofn__cgo_4543809e40d5_Cmacro_NULL byte
var _cgo_4543809e40d5_Cmacro_NULL = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cmacro_NULL)
//go:cgo_unsafe_args
func _Cmacro_NULL() (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cmacro_NULL, uintptr(unsafe.Pointer(&r1)))
if _Cgo_always_false {
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_clua_newstate
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_clua_newstate _cgo_4543809e40d5_Cfunc_clua_newstate
var __cgofn__cgo_4543809e40d5_Cfunc_clua_newstate byte
var _cgo_4543809e40d5_Cfunc_clua_newstate = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_clua_newstate)
//go:cgo_unsafe_args
func _Cfunc_clua_newstate(p0 unsafe.Pointer) (r1 *_Ctype_struct_lua_State) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_clua_newstate, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_free
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_free _cgo_4543809e40d5_Cfunc_free
var __cgofn__cgo_4543809e40d5_Cfunc_free byte
var _cgo_4543809e40d5_Cfunc_free = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_free)
//go:cgo_unsafe_args
func _Cfunc_free(p0 unsafe.Pointer) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_free, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_absindex
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_absindex _cgo_4543809e40d5_Cfunc_lua_absindex
var __cgofn__cgo_4543809e40d5_Cfunc_lua_absindex byte
var _cgo_4543809e40d5_Cfunc_lua_absindex = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_absindex)
//go:cgo_unsafe_args
func _Cfunc_lua_absindex(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_absindex, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_checkstack
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_checkstack _cgo_4543809e40d5_Cfunc_lua_checkstack
var __cgofn__cgo_4543809e40d5_Cfunc_lua_checkstack byte
var _cgo_4543809e40d5_Cfunc_lua_checkstack = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_checkstack)
//go:cgo_unsafe_args
func _Cfunc_lua_checkstack(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_checkstack, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_close
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_close _cgo_4543809e40d5_Cfunc_lua_close
var __cgofn__cgo_4543809e40d5_Cfunc_lua_close byte
var _cgo_4543809e40d5_Cfunc_lua_close = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_close)
//go:cgo_unsafe_args
func _Cfunc_lua_close(p0 *_Ctype_struct_lua_State) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_close, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_equal
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_equal _cgo_4543809e40d5_Cfunc_lua_equal
var __cgofn__cgo_4543809e40d5_Cfunc_lua_equal byte
var _cgo_4543809e40d5_Cfunc_lua_equal = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_equal)
//go:cgo_unsafe_args
func _Cfunc_lua_equal(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_equal, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_gettop
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_gettop _cgo_4543809e40d5_Cfunc_lua_gettop
var __cgofn__cgo_4543809e40d5_Cfunc_lua_gettop byte
var _cgo_4543809e40d5_Cfunc_lua_gettop = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_gettop)
//go:cgo_unsafe_args
func _Cfunc_lua_gettop(p0 *_Ctype_struct_lua_State) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_gettop, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_insert
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_insert _cgo_4543809e40d5_Cfunc_lua_insert
var __cgofn__cgo_4543809e40d5_Cfunc_lua_insert byte
var _cgo_4543809e40d5_Cfunc_lua_insert = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_insert)
//go:cgo_unsafe_args
func _Cfunc_lua_insert(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_insert, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_isLfunction
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_isLfunction _cgo_4543809e40d5_Cfunc_lua_isLfunction
var __cgofn__cgo_4543809e40d5_Cfunc_lua_isLfunction byte
var _cgo_4543809e40d5_Cfunc_lua_isLfunction = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_isLfunction)
//go:cgo_unsafe_args
func _Cfunc_lua_isLfunction(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_isLfunction, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_iscfunction
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_iscfunction _cgo_4543809e40d5_Cfunc_lua_iscfunction
var __cgofn__cgo_4543809e40d5_Cfunc_lua_iscfunction byte
var _cgo_4543809e40d5_Cfunc_lua_iscfunction = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_iscfunction)
//go:cgo_unsafe_args
func _Cfunc_lua_iscfunction(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_iscfunction, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_isnumber
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_isnumber _cgo_4543809e40d5_Cfunc_lua_isnumber
var __cgofn__cgo_4543809e40d5_Cfunc_lua_isnumber byte
var _cgo_4543809e40d5_Cfunc_lua_isnumber = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_isnumber)
//go:cgo_unsafe_args
func _Cfunc_lua_isnumber(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_isnumber, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_isstring
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_isstring _cgo_4543809e40d5_Cfunc_lua_isstring
var __cgofn__cgo_4543809e40d5_Cfunc_lua_isstring byte
var _cgo_4543809e40d5_Cfunc_lua_isstring = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_isstring)
//go:cgo_unsafe_args
func _Cfunc_lua_isstring(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_isstring, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_isthreadreset
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_isthreadreset _cgo_4543809e40d5_Cfunc_lua_isthreadreset
var __cgofn__cgo_4543809e40d5_Cfunc_lua_isthreadreset byte
var _cgo_4543809e40d5_Cfunc_lua_isthreadreset = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_isthreadreset)
//go:cgo_unsafe_args
func _Cfunc_lua_isthreadreset(p0 *_Ctype_struct_lua_State) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_isthreadreset, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_isuserdata
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_isuserdata _cgo_4543809e40d5_Cfunc_lua_isuserdata
var __cgofn__cgo_4543809e40d5_Cfunc_lua_isuserdata byte
var _cgo_4543809e40d5_Cfunc_lua_isuserdata = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_isuserdata)
//go:cgo_unsafe_args
func _Cfunc_lua_isuserdata(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_isuserdata, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_lessthan
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_lessthan _cgo_4543809e40d5_Cfunc_lua_lessthan
var __cgofn__cgo_4543809e40d5_Cfunc_lua_lessthan byte
var _cgo_4543809e40d5_Cfunc_lua_lessthan = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_lessthan)
//go:cgo_unsafe_args
func _Cfunc_lua_lessthan(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_lessthan, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_lightuserdatatag
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_lightuserdatatag _cgo_4543809e40d5_Cfunc_lua_lightuserdatatag
var __cgofn__cgo_4543809e40d5_Cfunc_lua_lightuserdatatag byte
var _cgo_4543809e40d5_Cfunc_lua_lightuserdatatag = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_lightuserdatatag)
//go:cgo_unsafe_args
func _Cfunc_lua_lightuserdatatag(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_lightuserdatatag, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_mainthread
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_mainthread _cgo_4543809e40d5_Cfunc_lua_mainthread
var __cgofn__cgo_4543809e40d5_Cfunc_lua_mainthread byte
var _cgo_4543809e40d5_Cfunc_lua_mainthread = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_mainthread)
//go:cgo_unsafe_args
func _Cfunc_lua_mainthread(p0 *_Ctype_struct_lua_State) (r1 *_Ctype_struct_lua_State) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_mainthread, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_namecallatom
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_namecallatom _cgo_4543809e40d5_Cfunc_lua_namecallatom
var __cgofn__cgo_4543809e40d5_Cfunc_lua_namecallatom byte
var _cgo_4543809e40d5_Cfunc_lua_namecallatom = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_namecallatom)
//go:cgo_unsafe_args
func _Cfunc_lua_namecallatom(p0 *_Ctype_struct_lua_State, p1 *_Ctype_int) (r1 *_Ctype_char) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_namecallatom, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_newthread
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_newthread _cgo_4543809e40d5_Cfunc_lua_newthread
var __cgofn__cgo_4543809e40d5_Cfunc_lua_newthread byte
var _cgo_4543809e40d5_Cfunc_lua_newthread = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_newthread)
//go:cgo_unsafe_args
func _Cfunc_lua_newthread(p0 *_Ctype_struct_lua_State) (r1 *_Ctype_struct_lua_State) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_newthread, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_objlen
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_objlen _cgo_4543809e40d5_Cfunc_lua_objlen
var __cgofn__cgo_4543809e40d5_Cfunc_lua_objlen byte
var _cgo_4543809e40d5_Cfunc_lua_objlen = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_objlen)
//go:cgo_unsafe_args
func _Cfunc_lua_objlen(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_objlen, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushcclosurek
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushcclosurek _cgo_4543809e40d5_Cfunc_lua_pushcclosurek
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushcclosurek byte
var _cgo_4543809e40d5_Cfunc_lua_pushcclosurek = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushcclosurek)
//go:cgo_unsafe_args
func _Cfunc_lua_pushcclosurek(p0 *_Ctype_struct_lua_State, p1 *[0]byte, p2 *_Ctype_char, p3 _Ctype_int, p4 *[0]byte) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushcclosurek, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
_Cgo_use(p3)
_Cgo_use(p4)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushinteger
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushinteger _cgo_4543809e40d5_Cfunc_lua_pushinteger
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushinteger byte
var _cgo_4543809e40d5_Cfunc_lua_pushinteger = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushinteger)
//go:cgo_unsafe_args
func _Cfunc_lua_pushinteger(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushinteger, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushlstring
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushlstring _cgo_4543809e40d5_Cfunc_lua_pushlstring
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushlstring byte
var _cgo_4543809e40d5_Cfunc_lua_pushlstring = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushlstring)
//go:cgo_unsafe_args
func _Cfunc_lua_pushlstring(p0 *_Ctype_struct_lua_State, p1 *_Ctype_char, p2 _Ctype_size_t) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushlstring, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushnil
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushnil _cgo_4543809e40d5_Cfunc_lua_pushnil
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushnil byte
var _cgo_4543809e40d5_Cfunc_lua_pushnil = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushnil)
//go:cgo_unsafe_args
func _Cfunc_lua_pushnil(p0 *_Ctype_struct_lua_State) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushnil, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushnumber
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushnumber _cgo_4543809e40d5_Cfunc_lua_pushnumber
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushnumber byte
var _cgo_4543809e40d5_Cfunc_lua_pushnumber = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushnumber)
//go:cgo_unsafe_args
func _Cfunc_lua_pushnumber(p0 *_Ctype_struct_lua_State, p1 _Ctype_double) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushnumber, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushstring
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushstring _cgo_4543809e40d5_Cfunc_lua_pushstring
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushstring byte
var _cgo_4543809e40d5_Cfunc_lua_pushstring = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushstring)
//go:cgo_unsafe_args
func _Cfunc_lua_pushstring(p0 *_Ctype_struct_lua_State, p1 *_Ctype_char) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushstring, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushunsigned
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushunsigned _cgo_4543809e40d5_Cfunc_lua_pushunsigned
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushunsigned byte
var _cgo_4543809e40d5_Cfunc_lua_pushunsigned = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushunsigned)
//go:cgo_unsafe_args
func _Cfunc_lua_pushunsigned(p0 *_Ctype_struct_lua_State, p1 _Ctype_uint) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushunsigned, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_pushvalue
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_pushvalue _cgo_4543809e40d5_Cfunc_lua_pushvalue
var __cgofn__cgo_4543809e40d5_Cfunc_lua_pushvalue byte
var _cgo_4543809e40d5_Cfunc_lua_pushvalue = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_pushvalue)
//go:cgo_unsafe_args
func _Cfunc_lua_pushvalue(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_pushvalue, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_rawcheckstack
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_rawcheckstack _cgo_4543809e40d5_Cfunc_lua_rawcheckstack
var __cgofn__cgo_4543809e40d5_Cfunc_lua_rawcheckstack byte
var _cgo_4543809e40d5_Cfunc_lua_rawcheckstack = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_rawcheckstack)
//go:cgo_unsafe_args
func _Cfunc_lua_rawcheckstack(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_rawcheckstack, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_rawequal
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_rawequal _cgo_4543809e40d5_Cfunc_lua_rawequal
var __cgofn__cgo_4543809e40d5_Cfunc_lua_rawequal byte
var _cgo_4543809e40d5_Cfunc_lua_rawequal = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_rawequal)
//go:cgo_unsafe_args
func _Cfunc_lua_rawequal(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_rawequal, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_remove
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_remove _cgo_4543809e40d5_Cfunc_lua_remove
var __cgofn__cgo_4543809e40d5_Cfunc_lua_remove byte
var _cgo_4543809e40d5_Cfunc_lua_remove = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_remove)
//go:cgo_unsafe_args
func _Cfunc_lua_remove(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_remove, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_replace
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_replace _cgo_4543809e40d5_Cfunc_lua_replace
var __cgofn__cgo_4543809e40d5_Cfunc_lua_replace byte
var _cgo_4543809e40d5_Cfunc_lua_replace = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_replace)
//go:cgo_unsafe_args
func _Cfunc_lua_replace(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_replace, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_resetthread
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_resetthread _cgo_4543809e40d5_Cfunc_lua_resetthread
var __cgofn__cgo_4543809e40d5_Cfunc_lua_resetthread byte
var _cgo_4543809e40d5_Cfunc_lua_resetthread = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_resetthread)
//go:cgo_unsafe_args
func _Cfunc_lua_resetthread(p0 *_Ctype_struct_lua_State) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_resetthread, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_settop
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_settop _cgo_4543809e40d5_Cfunc_lua_settop
var __cgofn__cgo_4543809e40d5_Cfunc_lua_settop byte
var _cgo_4543809e40d5_Cfunc_lua_settop = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_settop)
//go:cgo_unsafe_args
func _Cfunc_lua_settop(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_settop, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_toboolean
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_toboolean _cgo_4543809e40d5_Cfunc_lua_toboolean
var __cgofn__cgo_4543809e40d5_Cfunc_lua_toboolean byte
var _cgo_4543809e40d5_Cfunc_lua_toboolean = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_toboolean)
//go:cgo_unsafe_args
func _Cfunc_lua_toboolean(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_toboolean, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tobuffer
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tobuffer _cgo_4543809e40d5_Cfunc_lua_tobuffer
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tobuffer byte
var _cgo_4543809e40d5_Cfunc_lua_tobuffer = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tobuffer)
//go:cgo_unsafe_args
func _Cfunc_lua_tobuffer(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 *_Ctype_size_t) (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tobuffer, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tocfunction
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tocfunction _cgo_4543809e40d5_Cfunc_lua_tocfunction
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tocfunction byte
var _cgo_4543809e40d5_Cfunc_lua_tocfunction = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tocfunction)
//go:cgo_unsafe_args
func _Cfunc_lua_tocfunction(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_lua_CFunction) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tocfunction, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tointegerx
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tointegerx _cgo_4543809e40d5_Cfunc_lua_tointegerx
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tointegerx byte
var _cgo_4543809e40d5_Cfunc_lua_tointegerx = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tointegerx)
//go:cgo_unsafe_args
func _Cfunc_lua_tointegerx(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 *_Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tointegerx, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tolightuserdata
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tolightuserdata _cgo_4543809e40d5_Cfunc_lua_tolightuserdata
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tolightuserdata byte
var _cgo_4543809e40d5_Cfunc_lua_tolightuserdata = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tolightuserdata)
//go:cgo_unsafe_args
func _Cfunc_lua_tolightuserdata(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tolightuserdata, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tolightuserdatatagged
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tolightuserdatatagged _cgo_4543809e40d5_Cfunc_lua_tolightuserdatatagged
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tolightuserdatatagged byte
var _cgo_4543809e40d5_Cfunc_lua_tolightuserdatatagged = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tolightuserdatatagged)
//go:cgo_unsafe_args
func _Cfunc_lua_tolightuserdatatagged(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 _Ctype_int) (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tolightuserdatatagged, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tolstring
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tolstring _cgo_4543809e40d5_Cfunc_lua_tolstring
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tolstring byte
var _cgo_4543809e40d5_Cfunc_lua_tolstring = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tolstring)
//go:cgo_unsafe_args
func _Cfunc_lua_tolstring(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 *_Ctype_size_t) (r1 *_Ctype_char) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tolstring, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tonumberx
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tonumberx _cgo_4543809e40d5_Cfunc_lua_tonumberx
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tonumberx byte
var _cgo_4543809e40d5_Cfunc_lua_tonumberx = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tonumberx)
//go:cgo_unsafe_args
func _Cfunc_lua_tonumberx(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 *_Ctype_int) (r1 _Ctype_double) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tonumberx, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_topointer
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_topointer _cgo_4543809e40d5_Cfunc_lua_topointer
var __cgofn__cgo_4543809e40d5_Cfunc_lua_topointer byte
var _cgo_4543809e40d5_Cfunc_lua_topointer = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_topointer)
//go:cgo_unsafe_args
func _Cfunc_lua_topointer(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_topointer, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tostringatom
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tostringatom _cgo_4543809e40d5_Cfunc_lua_tostringatom
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tostringatom byte
var _cgo_4543809e40d5_Cfunc_lua_tostringatom = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tostringatom)
//go:cgo_unsafe_args
func _Cfunc_lua_tostringatom(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 *_Ctype_int) (r1 *_Ctype_char) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tostringatom, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tothread
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tothread _cgo_4543809e40d5_Cfunc_lua_tothread
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tothread byte
var _cgo_4543809e40d5_Cfunc_lua_tothread = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tothread)
//go:cgo_unsafe_args
func _Cfunc_lua_tothread(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 *_Ctype_struct_lua_State) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tothread, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tounsignedx
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tounsignedx _cgo_4543809e40d5_Cfunc_lua_tounsignedx
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tounsignedx byte
var _cgo_4543809e40d5_Cfunc_lua_tounsignedx = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tounsignedx)
//go:cgo_unsafe_args
func _Cfunc_lua_tounsignedx(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 *_Ctype_int) (r1 _Ctype_uint) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tounsignedx, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_touserdata
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_touserdata _cgo_4543809e40d5_Cfunc_lua_touserdata
var __cgofn__cgo_4543809e40d5_Cfunc_lua_touserdata byte
var _cgo_4543809e40d5_Cfunc_lua_touserdata = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_touserdata)
//go:cgo_unsafe_args
func _Cfunc_lua_touserdata(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_touserdata, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_touserdatatagged
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_touserdatatagged _cgo_4543809e40d5_Cfunc_lua_touserdatatagged
var __cgofn__cgo_4543809e40d5_Cfunc_lua_touserdatatagged byte
var _cgo_4543809e40d5_Cfunc_lua_touserdatatagged = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_touserdatatagged)
//go:cgo_unsafe_args
func _Cfunc_lua_touserdatatagged(p0 *_Ctype_struct_lua_State, p1 _Ctype_int, p2 _Ctype_int) (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_touserdatatagged, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_tovector
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_tovector _cgo_4543809e40d5_Cfunc_lua_tovector
var __cgofn__cgo_4543809e40d5_Cfunc_lua_tovector byte
var _cgo_4543809e40d5_Cfunc_lua_tovector = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_tovector)
//go:cgo_unsafe_args
func _Cfunc_lua_tovector(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 *_Ctype_float) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_tovector, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_type
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_type _cgo_4543809e40d5_Cfunc_lua_type
var __cgofn__cgo_4543809e40d5_Cfunc_lua_type byte
var _cgo_4543809e40d5_Cfunc_lua_type = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_type)
//go:cgo_unsafe_args
func _Cfunc_lua_type(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_type, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_typename
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_typename _cgo_4543809e40d5_Cfunc_lua_typename
var __cgofn__cgo_4543809e40d5_Cfunc_lua_typename byte
var _cgo_4543809e40d5_Cfunc_lua_typename = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_typename)
//go:cgo_unsafe_args
func _Cfunc_lua_typename(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 *_Ctype_char) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_typename, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_userdatatag
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_userdatatag _cgo_4543809e40d5_Cfunc_lua_userdatatag
var __cgofn__cgo_4543809e40d5_Cfunc_lua_userdatatag byte
var _cgo_4543809e40d5_Cfunc_lua_userdatatag = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_userdatatag)
//go:cgo_unsafe_args
func _Cfunc_lua_userdatatag(p0 *_Ctype_struct_lua_State, p1 _Ctype_int) (r1 _Ctype_int) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_userdatatag, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_xmove
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_xmove _cgo_4543809e40d5_Cfunc_lua_xmove
var __cgofn__cgo_4543809e40d5_Cfunc_lua_xmove byte
var _cgo_4543809e40d5_Cfunc_lua_xmove = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_xmove)
//go:cgo_unsafe_args
func _Cfunc_lua_xmove(p0 *_Ctype_struct_lua_State, p1 *_Ctype_struct_lua_State, p2 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_xmove, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc_lua_xpush
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc_lua_xpush _cgo_4543809e40d5_Cfunc_lua_xpush
var __cgofn__cgo_4543809e40d5_Cfunc_lua_xpush byte
var _cgo_4543809e40d5_Cfunc_lua_xpush = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc_lua_xpush)
//go:cgo_unsafe_args
func _Cfunc_lua_xpush(p0 *_Ctype_struct_lua_State, p1 *_Ctype_struct_lua_State, p2 _Ctype_int) (r1 _Ctype_void) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc_lua_xpush, uintptr(unsafe.Pointer(&p0)))
if _Cgo_always_false {
_Cgo_use(p0)
_Cgo_use(p1)
_Cgo_use(p2)
}
return
}
//go:cgo_export_dynamic go_allocf
//go:linkname _cgoexp_4543809e40d5_go_allocf _cgoexp_4543809e40d5_go_allocf
//go:cgo_export_static _cgoexp_4543809e40d5_go_allocf
func _cgoexp_4543809e40d5_go_allocf(a *struct {
p0 uintptr
p1 uintptr
p2 uint64
p3 uint64
r0 uintptr
}) {
a.r0 = go_allocf(a.p0, a.p1, a.p2, a.p3)
_cgoCheckResult(a.r0)
}
//go:cgo_import_static _cgo_4543809e40d5_Cfunc__Cmalloc
//go:linkname __cgofn__cgo_4543809e40d5_Cfunc__Cmalloc _cgo_4543809e40d5_Cfunc__Cmalloc
var __cgofn__cgo_4543809e40d5_Cfunc__Cmalloc byte
var _cgo_4543809e40d5_Cfunc__Cmalloc = unsafe.Pointer(&__cgofn__cgo_4543809e40d5_Cfunc__Cmalloc)
//go:linkname runtime_throw runtime.throw
func runtime_throw(string)
//go:cgo_unsafe_args
func _cgo_cmalloc(p0 uint64) (r1 unsafe.Pointer) {
_cgo_runtime_cgocall(_cgo_4543809e40d5_Cfunc__Cmalloc, uintptr(unsafe.Pointer(&p0)))
if r1 == nil {
runtime_throw("runtime: C malloc failed")
}
return
}

11
_obj/_cgo_main.c Normal file
View file

@ -0,0 +1,11 @@
#include <stddef.h>
int main() { return 0; }
void crosscall2(void(*fn)(void*) __attribute__((unused)), void *a __attribute__((unused)), int c __attribute__((unused)), size_t ctxt __attribute__((unused))) { }
size_t _cgo_wait_runtime_init_done(void) { return 0; }
void _cgo_release_context(size_t ctxt __attribute__((unused))) { }
char* _cgo_topofstack(void) { return (char*)0; }
void _cgo_allocate(void *a __attribute__((unused)), int c __attribute__((unused))) { }
void _cgo_panic(void *a __attribute__((unused)), int c __attribute__((unused))) { }
void _cgo_reginit(void) { }
#line 1 "cgo-generated-wrappers"
void _cgoexp_4543809e40d5_go_allocf(void* p){}

303
_obj/lua.cgo1.go Normal file
View file

@ -0,0 +1,303 @@
// Code generated by cmd/cgo; DO NOT EDIT.
//line /home/compey/dev/gluau/internal/lua.go:1:1
package internal; import _cgo_unsafe "unsafe"
/*
#cgo CFLAGS: -Iluau/VM/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include
// #cgo LDFLAGS: -L${SRCDIR}/luau/cmake -lLuau.VM -lm -lstdc++
#include "/home/compey/dev/gluau/internal/luau/VM/include/lua.h"
#include "/home/compey/dev/gluau/internal/luau/VM/include/lualib.h"
#include <stdlib.h>
#include "/home/compey/dev/gluau/internal/clua.h"
*/
import _ "unsafe"
import "unsafe"
type lua_Number float64
type lua_Integer int32
type lua_Unsigned int32
type lua_CFunction func(L * /*line :18:28*/_Ctype_lua_State /*line :18:39*/) int32
type lua_Continuation func(L * /*line :19:31*/_Ctype_lua_State /*line :19:42*/, status int32) int32
type lua_Udestructor = func(* /*line :21:30*/_Ctype_void /*line :21:36*/)
type lua_Destructor = func(L * /*line :22:31*/_Ctype_lua_State /*line :22:42*/, _ unsafe.Pointer)
// type lua_Alloc = func(ud, ptr *C.void, osize, nsize C.size_t) *C.void
type lua_Alloc = func(ptr unsafe.Pointer, osize, nsize uint64) unsafe.Pointer
//export go_allocf
func go_allocf(fp uintptr, ptr uintptr, osize uint64, nsize uint64) uintptr {
p := ((*((*lua_Alloc)(unsafe.Pointer(fp))))(unsafe.Pointer(ptr), osize, nsize))
return uintptr(p)
}
//
// ==================
// VM state
// ==================
//
func NewState(ud unsafe.Pointer) * /*line :39:35*/_Ctype_lua_State /*line :39:46*/ {
return func() *_Ctype_struct_lua_State{ _cgo0 := /*line :40:25*/unsafe.Pointer(ud); _cgoCheckPointer(_cgo0, nil); return /*line :40:44*/_Cfunc_clua_newstate(_cgo0); }()
}
func LuaClose(L * /*line :43:18*/_Ctype_lua_State /*line :43:29*/) {
func() { _cgo0 := /*line :44:14*/L; _cgoCheckPointer(_cgo0, nil); /*line :44:16*/_Cfunc_lua_close(_cgo0); }()
}
func NewThread(L * /*line :47:19*/_Ctype_lua_State /*line :47:30*/) * /*line :47:33*/_Ctype_lua_State /*line :47:44*/ {
return func() *_Ctype_struct_lua_State{ _cgo0 := /*line :48:25*/L; _cgoCheckPointer(_cgo0, nil); return /*line :48:27*/_Cfunc_lua_newthread(_cgo0); }()
}
func MainThread(L * /*line :51:20*/_Ctype_lua_State /*line :51:31*/) * /*line :51:34*/_Ctype_lua_State /*line :51:45*/ {
return func() *_Ctype_struct_lua_State{ _cgo0 := /*line :52:26*/L; _cgoCheckPointer(_cgo0, nil); return /*line :52:28*/_Cfunc_lua_mainthread(_cgo0); }()
}
func ResetThread(L * /*line :55:21*/_Ctype_lua_State /*line :55:32*/) {
func() { _cgo0 := /*line :56:20*/L; _cgoCheckPointer(_cgo0, nil); /*line :56:22*/_Cfunc_lua_resetthread(_cgo0); }()
}
func IsThreadReset(L * /*line :59:23*/_Ctype_lua_State /*line :59:34*/) bool {
return func() _Ctype_int{ _cgo0 := /*line :60:29*/L; _cgoCheckPointer(_cgo0, nil); return /*line :60:31*/_Cfunc_lua_isthreadreset(_cgo0); }() != 0
}
//
// ==================
// VM Stack
// ==================
//
func AbsIndex(L * /*line :69:18*/_Ctype_lua_State /*line :69:29*/, idx int32) int32 {
return int32(func() _Ctype_int{ _cgo0 := /*line :70:30*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :70:38*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :70:44*/_Cfunc_lua_absindex(_cgo0, _cgo1); }())
}
func GetTop(L * /*line :73:16*/_Ctype_lua_State /*line :73:27*/) int32 {
return int32(func() _Ctype_int{ _cgo0 := /*line :74:28*/L; _cgoCheckPointer(_cgo0, nil); return /*line :74:30*/_Cfunc_lua_gettop(_cgo0); }())
}
func SetTop(L * /*line :77:16*/_Ctype_lua_State /*line :77:27*/, idx int32) {
func() { _cgo0 := /*line :78:15*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :78:23*/(idx); _cgoCheckPointer(_cgo0, nil); /*line :78:29*/_Cfunc_lua_settop(_cgo0, _cgo1); }()
}
func PushValue(L * /*line :81:19*/_Ctype_lua_State /*line :81:30*/, idx int32) {
func() { _cgo0 := /*line :82:18*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :82:26*/(idx); _cgoCheckPointer(_cgo0, nil); /*line :82:32*/_Cfunc_lua_pushvalue(_cgo0, _cgo1); }()
}
func Remove(L * /*line :85:16*/_Ctype_lua_State /*line :85:27*/, idx int32) {
func() { _cgo0 := /*line :86:15*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :86:23*/(idx); _cgoCheckPointer(_cgo0, nil); /*line :86:29*/_Cfunc_lua_remove(_cgo0, _cgo1); }()
}
func Insert(L * /*line :89:16*/_Ctype_lua_State /*line :89:27*/, idx int32) {
func() { _cgo0 := /*line :90:15*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :90:23*/(idx); _cgoCheckPointer(_cgo0, nil); /*line :90:29*/_Cfunc_lua_insert(_cgo0, _cgo1); }()
}
func Replace(L * /*line :93:17*/_Ctype_lua_State /*line :93:28*/, idx int32) {
func() { _cgo0 := /*line :94:16*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :94:24*/(idx); _cgoCheckPointer(_cgo0, nil); /*line :94:30*/_Cfunc_lua_replace(_cgo0, _cgo1); }()
}
func CheckStack(L * /*line :97:20*/_Ctype_lua_State /*line :97:31*/, sz int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :98:26*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :98:34*/(sz); _cgoCheckPointer(_cgo0, nil); return /*line :98:39*/_Cfunc_lua_checkstack(_cgo0, _cgo1); }() != 0
}
func RawCheckStack(L * /*line :101:23*/_Ctype_lua_State /*line :101:34*/, sz int32) {
func() { _cgo0 := /*line :102:22*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :102:30*/(sz); _cgoCheckPointer(_cgo0, nil); /*line :102:35*/_Cfunc_lua_rawcheckstack(_cgo0, _cgo1); }()
}
func XMove(from, to * /*line :105:22*/_Ctype_lua_State /*line :105:33*/, n int32) {
func() { _cgo0 := /*line :106:14*/from; _cgo1 := /*line :106:20*/to; var _cgo2 _Ctype_int = _Ctype_int /*line :106:29*/(n); _cgoCheckPointer(_cgo0, nil); _cgoCheckPointer(_cgo1, nil); /*line :106:33*/_Cfunc_lua_xmove(_cgo0, _cgo1, _cgo2); }()
}
func XPush(from, to * /*line :109:22*/_Ctype_lua_State /*line :109:33*/, idx int32) {
func() { _cgo0 := /*line :110:14*/from; _cgo1 := /*line :110:20*/to; var _cgo2 _Ctype_int = _Ctype_int /*line :110:29*/(idx); _cgoCheckPointer(_cgo0, nil); _cgoCheckPointer(_cgo1, nil); /*line :110:35*/_Cfunc_lua_xpush(_cgo0, _cgo1, _cgo2); }()
}
//
// ======================
// Stack Values
// ======================
//
func IsNumber(L * /*line :119:18*/_Ctype_lua_State /*line :119:29*/, idx int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :120:24*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :120:32*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :120:38*/_Cfunc_lua_isnumber(_cgo0, _cgo1); }() != 0
}
func IsString(L * /*line :123:18*/_Ctype_lua_State /*line :123:29*/, idx int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :124:24*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :124:32*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :124:38*/_Cfunc_lua_isstring(_cgo0, _cgo1); }() != 0
}
func IsCFunction(L * /*line :127:21*/_Ctype_lua_State /*line :127:32*/, idx int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :128:27*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :128:35*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :128:41*/_Cfunc_lua_iscfunction(_cgo0, _cgo1); }() != 0
}
func IsLFunction(L * /*line :131:21*/_Ctype_lua_State /*line :131:32*/, idx int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :132:27*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :132:35*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :132:41*/_Cfunc_lua_isLfunction(_cgo0, _cgo1); }() != 0
}
func IsUserData(L * /*line :135:20*/_Ctype_lua_State /*line :135:31*/, idx int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :136:26*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :136:34*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :136:40*/_Cfunc_lua_isuserdata(_cgo0, _cgo1); }() != 0
}
func Type(L * /*line :139:14*/_Ctype_lua_State /*line :139:25*/, idx int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :140:20*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :140:28*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :140:34*/_Cfunc_lua_type(_cgo0, _cgo1); }() != 0
}
func TypeName(L * /*line :143:18*/_Ctype_lua_State /*line :143:29*/, tp int32) string {
return ( /*line :144:9*/_Cfunc_GoString /*line :144:18*/)(func() *_Ctype_char{ _cgo0 := /*line :144:35*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :144:43*/(tp); _cgoCheckPointer(_cgo0, nil); return /*line :144:48*/_Cfunc_lua_typename(_cgo0, _cgo1); }())
}
func Equal(L * /*line :147:15*/_Ctype_lua_State /*line :147:26*/, idx1, idx2 int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :148:21*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :148:29*/(idx1); var _cgo2 _Ctype_int = _Ctype_int /*line :148:42*/(idx2); _cgoCheckPointer(_cgo0, nil); return /*line :148:49*/_Cfunc_lua_equal(_cgo0, _cgo1, _cgo2); }() != 0
}
func RawEqual(L * /*line :151:18*/_Ctype_lua_State /*line :151:29*/, idx1, idx2 int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :152:24*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :152:32*/(idx1); var _cgo2 _Ctype_int = _Ctype_int /*line :152:45*/(idx2); _cgoCheckPointer(_cgo0, nil); return /*line :152:52*/_Cfunc_lua_rawequal(_cgo0, _cgo1, _cgo2); }() != 0
}
func LessThan(L * /*line :155:18*/_Ctype_lua_State /*line :155:29*/, idx1, idx2 int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :156:24*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :156:32*/(idx1); var _cgo2 _Ctype_int = _Ctype_int /*line :156:45*/(idx2); _cgoCheckPointer(_cgo0, nil); return /*line :156:52*/_Cfunc_lua_lessthan(_cgo0, _cgo1, _cgo2); }() != 0
}
func ToNumberX(L * /*line :159:19*/_Ctype_lua_State /*line :159:30*/, idx int32, isnum bool) lua_Number {
isnumInner := /*line :160:16*/_Ctype_int /*line :160:21*/(0)
if isnum {
isnumInner = /*line :162:16*/_Ctype_int /*line :162:21*/(1)
}
return lua_Number(func() _Ctype_double{ _cgo0 := /*line :165:36*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :165:44*/(idx); var _cgo2 *_Ctype_int = /*line :165:51*/&isnumInner; _cgoCheckPointer(_cgo0, nil); return /*line :165:63*/_Cfunc_lua_tonumberx(_cgo0, _cgo1, _cgo2); }())
}
func ToIntegerX(L * /*line :168:20*/_Ctype_lua_State /*line :168:31*/, idx int32, isnum bool) lua_Integer {
isnumInner := /*line :169:16*/_Ctype_int /*line :169:21*/(0)
if isnum {
isnumInner = /*line :171:16*/_Ctype_int /*line :171:21*/(1)
}
return lua_Integer(func() _Ctype_int{ _cgo0 := /*line :174:38*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :174:46*/(idx); var _cgo2 *_Ctype_int = /*line :174:53*/&isnumInner; _cgoCheckPointer(_cgo0, nil); return /*line :174:65*/_Cfunc_lua_tointegerx(_cgo0, _cgo1, _cgo2); }())
}
func ToUnsignedX(L * /*line :177:21*/_Ctype_lua_State /*line :177:32*/, idx int32, isnum bool) lua_Unsigned {
isnumInner := /*line :178:16*/_Ctype_int /*line :178:21*/(0)
if isnum {
isnumInner = /*line :180:16*/_Ctype_int /*line :180:21*/(1)
}
return lua_Unsigned(func() _Ctype_uint{ _cgo0 := /*line :183:40*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :183:48*/(idx); var _cgo2 *_Ctype_int = /*line :183:55*/&isnumInner; _cgoCheckPointer(_cgo0, nil); return /*line :183:67*/_Cfunc_lua_tounsignedx(_cgo0, _cgo1, _cgo2); }())
}
func ToVector(L * /*line :186:18*/_Ctype_lua_State /*line :186:29*/, idx int32) {
func() *_Ctype_float{ _cgo0 := /*line :187:17*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :187:25*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :187:31*/_Cfunc_lua_tovector(_cgo0, _cgo1); }()
}
func ToBoolean(L * /*line :190:19*/_Ctype_lua_State /*line :190:30*/, idx int32) bool {
return func() _Ctype_int{ _cgo0 := /*line :191:25*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :191:33*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :191:39*/_Cfunc_lua_toboolean(_cgo0, _cgo1); }() != 0
}
func ToLString(L * /*line :194:19*/_Ctype_lua_State /*line :194:30*/, idx int32, len *uint64) string {
return ( /*line :195:9*/_Cfunc_GoString /*line :195:18*/)(func() *_Ctype_char{ _cgo0 := /*line :195:36*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :195:44*/(idx); var _cgo2 *_Ctype_size_t = /*line :195:51*/(*_Ctype_size_t /*line :195:61*/)(len); _cgoCheckPointer(_cgo0, nil); return /*line :195:68*/_Cfunc_lua_tolstring(_cgo0, _cgo1, _cgo2); }())
}
func ToStringAtom(L * /*line :198:22*/_Ctype_lua_State /*line :198:33*/, idx int32, atom *int32) string {
return ( /*line :199:9*/_Cfunc_GoString /*line :199:18*/)(func() *_Ctype_char{ _cgo0 := /*line :199:39*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :199:47*/(idx); var _cgo2 *_Ctype_int = /*line :199:54*/(*_Ctype_int /*line :199:61*/)(atom); _cgoCheckPointer(_cgo0, nil); return /*line :199:69*/_Cfunc_lua_tostringatom(_cgo0, _cgo1, _cgo2); }())
}
func NameCallAtom(L * /*line :202:22*/_Ctype_lua_State /*line :202:33*/, atom *int32) string {
return ( /*line :203:9*/_Cfunc_GoString /*line :203:18*/)(func() *_Ctype_char{ _cgo0 := /*line :203:39*/L; var _cgo1 *_Ctype_int = /*line :203:42*/(*_Ctype_int /*line :203:49*/)(atom); _cgoCheckPointer(_cgo0, nil); return /*line :203:57*/_Cfunc_lua_namecallatom(_cgo0, _cgo1); }())
}
func ObjLen(L * /*line :206:16*/_Ctype_lua_State /*line :206:27*/, idx int32) uint64 {
return uint64(func() _Ctype_int{ _cgo0 := /*line :207:29*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :207:37*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :207:43*/_Cfunc_lua_objlen(_cgo0, _cgo1); }())
}
func ToCFunction(L * /*line :210:21*/_Ctype_lua_State /*line :210:32*/, idx int32) lua_CFunction {
p := unsafe.Pointer(func() _Ctype_lua_CFunction{ _cgo0 := /*line :211:40*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :211:48*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :211:54*/_Cfunc_lua_tocfunction(_cgo0, _cgo1); }())
if p == ( /*line :212:10*/_Cmacro_NULL() /*line :212:15*/) {
return nil
}
return *(*lua_CFunction)(p)
}
func ToLightUserdata(L * /*line :219:25*/_Ctype_lua_State /*line :219:36*/, idx int32) unsafe.Pointer {
return unsafe.Pointer(func() _cgo_unsafe.Pointer{ _cgo0 := /*line :220:46*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :220:54*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :220:60*/_Cfunc_lua_tolightuserdata(_cgo0, _cgo1); }())
}
func ToLightUserdataTagged(L * /*line :223:31*/_Ctype_lua_State /*line :223:42*/, idx int32, tag int32) unsafe.Pointer {
return unsafe.Pointer(func() _cgo_unsafe.Pointer{ _cgo0 := /*line :224:52*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :224:60*/(idx); var _cgo2 _Ctype_int = _Ctype_int /*line :224:72*/(tag); _cgoCheckPointer(_cgo0, nil); return /*line :224:78*/_Cfunc_lua_tolightuserdatatagged(_cgo0, _cgo1, _cgo2); }())
}
func ToUserdata(L * /*line :227:20*/_Ctype_lua_State /*line :227:31*/, idx int32) unsafe.Pointer {
return unsafe.Pointer(func() _cgo_unsafe.Pointer{ _cgo0 := /*line :228:41*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :228:49*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :228:55*/_Cfunc_lua_touserdata(_cgo0, _cgo1); }())
}
func ToUserdataTagged(L * /*line :231:26*/_Ctype_lua_State /*line :231:37*/, idx int32, tag int32) unsafe.Pointer {
return unsafe.Pointer(func() _cgo_unsafe.Pointer{ _cgo0 := /*line :232:47*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :232:55*/(idx); var _cgo2 _Ctype_int = _Ctype_int /*line :232:67*/(tag); _cgoCheckPointer(_cgo0, nil); return /*line :232:73*/_Cfunc_lua_touserdatatagged(_cgo0, _cgo1, _cgo2); }())
}
func UserdataTag(L * /*line :235:21*/_Ctype_lua_State /*line :235:32*/, idx int32) int32 {
return int32(func() _Ctype_int{ _cgo0 := /*line :236:33*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :236:41*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :236:47*/_Cfunc_lua_userdatatag(_cgo0, _cgo1); }())
}
func LightUserdataTag(L * /*line :239:26*/_Ctype_lua_State /*line :239:37*/, idx int32) int32 {
return int32(func() _Ctype_int{ _cgo0 := /*line :240:38*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :240:46*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :240:52*/_Cfunc_lua_lightuserdatatag(_cgo0, _cgo1); }())
}
func ToThread(L * /*line :243:18*/_Ctype_lua_State /*line :243:29*/, idx int32) * /*line :243:43*/_Ctype_lua_State /*line :243:54*/ {
return func() *_Ctype_struct_lua_State{ _cgo0 := /*line :244:24*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :244:32*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :244:38*/_Cfunc_lua_tothread(_cgo0, _cgo1); }()
}
func ToBuffer(L * /*line :247:18*/_Ctype_lua_State /*line :247:29*/, idx int32, len *uint64) unsafe.Pointer {
return unsafe.Pointer(func() _cgo_unsafe.Pointer{ _cgo0 := /*line :248:39*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :248:47*/(idx); var _cgo2 *_Ctype_size_t = /*line :248:54*/(*_Ctype_size_t /*line :248:64*/)(len); _cgoCheckPointer(_cgo0, nil); return /*line :248:71*/_Cfunc_lua_tobuffer(_cgo0, _cgo1, _cgo2); }())
}
func ToPointer(L * /*line :251:19*/_Ctype_lua_State /*line :251:30*/, idx int32) unsafe.Pointer {
return unsafe.Pointer(func() _cgo_unsafe.Pointer{ _cgo0 := /*line :252:40*/L; var _cgo1 _Ctype_int = _Ctype_int /*line :252:48*/(idx); _cgoCheckPointer(_cgo0, nil); return /*line :252:54*/_Cfunc_lua_topointer(_cgo0, _cgo1); }())
}
// =======================
// Stack Manipulation
// =======================
func PushNil(L * /*line :259:17*/_Ctype_lua_State /*line :259:28*/) {
func() { _cgo0 := /*line :260:16*/L; _cgoCheckPointer(_cgo0, nil); /*line :260:18*/_Cfunc_lua_pushnil(_cgo0); }()
}
func PushNumber(L * /*line :263:20*/_Ctype_lua_State /*line :263:31*/, n lua_Number) {
func() { _cgo0 := /*line :264:19*/L; var _cgo1 _Ctype_double = _Ctype_lua_Number /*line :264:34*/(n); _cgoCheckPointer(_cgo0, nil); /*line :264:38*/_Cfunc_lua_pushnumber(_cgo0, _cgo1); }()
}
func PushInteger(L * /*line :267:21*/_Ctype_lua_State /*line :267:32*/, n lua_Integer) {
func() { _cgo0 := /*line :268:20*/L; var _cgo1 _Ctype_int = _Ctype_lua_Integer /*line :268:36*/(n); _cgoCheckPointer(_cgo0, nil); /*line :268:40*/_Cfunc_lua_pushinteger(_cgo0, _cgo1); }()
}
func PushUnsigned(L * /*line :271:22*/_Ctype_lua_State /*line :271:33*/, n lua_Unsigned) {
func() { _cgo0 := /*line :272:21*/L; var _cgo1 _Ctype_uint = _Ctype_lua_Unsigned /*line :272:38*/(n); _cgoCheckPointer(_cgo0, nil); /*line :272:42*/_Cfunc_lua_pushunsigned(_cgo0, _cgo1); }()
}
func PushLString(L * /*line :275:21*/_Ctype_lua_State /*line :275:32*/, s string, l uint64) {
cs := ( /*line :276:8*/_Cfunc_CString /*line :276:16*/)(s)
defer func() func() { _cgo0 := /*line :277:15*/unsafe.Pointer(cs); return func() { _cgoCheckPointer(_cgo0, nil); /*line :277:34*/_Cfunc_free(_cgo0); }}()()
func() { _cgo0 := /*line :279:20*/L; var _cgo1 *_Ctype_char = /*line :279:23*/cs; var _cgo2 _Ctype_size_t = _Ctype_size_t /*line :279:35*/(l); _cgoCheckPointer(_cgo0, nil); /*line :279:39*/_Cfunc_lua_pushlstring(_cgo0, _cgo1, _cgo2); }()
}
func PushString(L * /*line :282:20*/_Ctype_lua_State /*line :282:31*/, s string) {
cs := ( /*line :283:8*/_Cfunc_CString /*line :283:16*/)(s)
defer func() func() { _cgo0 := /*line :284:15*/unsafe.Pointer(cs); return func() { _cgoCheckPointer(_cgo0, nil); /*line :284:34*/_Cfunc_free(_cgo0); }}()()
func() { _cgo0 := /*line :286:19*/L; var _cgo1 *_Ctype_char = /*line :286:22*/cs; _cgoCheckPointer(_cgo0, nil); /*line :286:25*/_Cfunc_lua_pushstring(_cgo0, _cgo1); }()
}
// NOTE: We can't have lua_pushfstringL, since varadic
// arguments from Go->C isn't something that is possible.
// func PushFStringL(L *C.lua_State, fmt string) {}
func PushCClosureK(L * /*line :293:23*/_Ctype_lua_State /*line :293:34*/, f lua_CFunction, debugname string, nup int32, cont lua_Continuation) {
cdebugname := ( /*line :294:16*/_Cfunc_CString /*line :294:24*/)(debugname)
defer func() func() { _cgo0 := /*line :295:15*/unsafe.Pointer(cdebugname); return func() { _cgoCheckPointer(_cgo0, nil); /*line :295:42*/_Cfunc_free(_cgo0); }}()()
func() { _cgo0 := /*line :297:22*/L; var _cgo1 *[0]byte = /*line :297:25*/(_Ctype_lua_CFunction /*line :297:41*/)(f); var _cgo2 *_Ctype_char = /*line :297:47*/cdebugname; var _cgo3 _Ctype_int = _Ctype_int /*line :297:64*/(nup); var _cgo4 *[0]byte = /*line :297:71*/(*_Ctype_lua_Continuation /*line :297:91*/)(cont); _cgoCheckPointer(_cgo0, nil); /*line :297:99*/_Cfunc_lua_pushcclosurek(_cgo0, _cgo1, _cgo2, _cgo3, _cgo4); }()
}
// TODO: Rest of it

1076
_obj/lua.cgo2.c Normal file

File diff suppressed because it is too large Load diff

91
internal/_cgo_export.h Normal file
View file

@ -0,0 +1,91 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */
/* package internal */
#line 1 "cgo-builtin-export-prolog"
#include <stddef.h>
#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif
#endif
/* Start of preamble from import "C" comments. */
#line 3 "lua.go"
// #cgo LDFLAGS: -L${SRCDIR}/luau/cmake -lLuau.VM -lm -lstdc++
#include "/home/compey/dev/gluau/internal/luau/VM/include/lua.h"
#include "/home/compey/dev/gluau/internal/luau/VM/include/lualib.h"
#include <stdlib.h>
#include "/home/compey/dev/gluau/internal/clua.h"
#line 1 "cgo-generated-wrapper"
/* End of preamble from import "C" comments. */
/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"
#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H
typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif
/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
#endif
/* End of boilerplate cgo prologue. */
#ifdef __cplusplus
extern "C" {
#endif
extern GoUintptr go_allocf(GoUintptr fp, GoUintptr ptr, GoUint64 osize, GoUint64 nsize);
#ifdef __cplusplus
}
#endif

View file

@ -16,3 +16,7 @@ l_noret cluaL_errorL(lua_State* L, char* msg)
{ {
luaL_errorL(L, msg); luaL_errorL(L, msg);
} }
void clua_pushcclosurek(lua_State* L, void* f, char* debugname, int nup, void* cont) {
return lua_pushcclosurek(L, f, debugname, nup, cont);
}

View file

@ -3,4 +3,5 @@
void* clua_alloc(void* ud, void *ptr, size_t osize, size_t nsize); void* clua_alloc(void* ud, void *ptr, size_t osize, size_t nsize);
lua_State* clua_newstate(void* goallocf); lua_State* clua_newstate(void* goallocf);
l_noret cluaL_errorL(lua_State* L, char* msg); l_noret cluaL_errorL(lua_State* L, char* msg);
void clua_pushcclosurek(lua_State* L, void* f, char* debugname, int nup, void* cont);

View file

@ -27,51 +27,51 @@ static void freeCharArray(char** a, int size) {
import "C" import "C"
import "unsafe" import "unsafe"
type luaL_Reg C.luaL_Reg type LuaLReg C.luaL_Reg
func LRegister(L *C.lua_State, libname string, l *luaL_Reg) { func LRegister(L *LuaState, libname string, l *LuaLReg) {
clibname := C.CString(libname) clibname := C.CString(libname)
defer C.free(unsafe.Pointer(clibname)) defer C.free(unsafe.Pointer(clibname))
C.luaL_register(L, clibname, (*C.luaL_Reg)(l)) C.luaL_register(L, clibname, (*C.luaL_Reg)(l))
} }
func LGetMetaField(L *C.lua_State, obj int32, e string) int32 { func LGetMetaField(L *LuaState, obj int32, e string) int32 {
ce := C.CString(e) ce := C.CString(e)
defer C.free(unsafe.Pointer(ce)) defer C.free(unsafe.Pointer(ce))
return int32(C.luaL_getmetafield(L, C.int(obj), ce)) return int32(C.luaL_getmetafield(L, C.int(obj), ce))
} }
func LCallMeta(L *C.lua_State, obj int32, e string) int32 { func LCallMeta(L *LuaState, obj int32, e string) int32 {
ce := C.CString(e) ce := C.CString(e)
defer C.free(unsafe.Pointer(ce)) defer C.free(unsafe.Pointer(ce))
return int32(C.luaL_callmeta(L, C.int(obj), ce)) return int32(C.luaL_callmeta(L, C.int(obj), ce))
} }
func LTypeError(L *C.lua_State, narg int32, tname string) { func LTypeError(L *LuaState, narg int32, tname string) {
ctname := C.CString(tname) ctname := C.CString(tname)
defer C.free(unsafe.Pointer(ctname)) defer C.free(unsafe.Pointer(ctname))
C.luaL_typeerrorL(L, C.int(narg), ctname) C.luaL_typeerrorL(L, C.int(narg), ctname)
} }
func LArgError(L *C.lua_State, narg int32, extramsg string) { func LArgError(L *LuaState, narg int32, extramsg string) {
cextramsg := C.CString(extramsg) cextramsg := C.CString(extramsg)
defer C.free(unsafe.Pointer(cextramsg)) defer C.free(unsafe.Pointer(cextramsg))
C.luaL_argerrorL(L, C.int(narg), cextramsg) C.luaL_argerrorL(L, C.int(narg), cextramsg)
} }
func LCheckLString(L *C.lua_State, narg int32, l *uint64) string { func LCheckLString(L *LuaState, narg int32, l *uint64) string {
p := C.luaL_checklstring(L, C.int(narg), (*C.size_t)(l)) p := C.luaL_checklstring(L, C.int(narg), (*C.size_t)(l))
defer C.free(unsafe.Pointer(p)) defer C.free(unsafe.Pointer(p))
return C.GoString(p) return C.GoString(p)
} }
func LOptLString(L *C.lua_State, narg int32, def string, l *uint64) string { func LOptLString(L *LuaState, narg int32, def string, l *uint64) string {
cdef := C.CString(def) cdef := C.CString(def)
defer C.free(unsafe.Pointer(cdef)) defer C.free(unsafe.Pointer(cdef))
@ -81,19 +81,19 @@ func LOptLString(L *C.lua_State, narg int32, def string, l *uint64) string {
return C.GoString(p) return C.GoString(p)
} }
func LCheckNumber(L *C.lua_State, narg int32) lua_Number { func LCheckNumber(L *LuaState, narg int32) LuaNumber {
return lua_Number(C.luaL_checknumber(L, C.int(narg))) return LuaNumber(C.luaL_checknumber(L, C.int(narg)))
} }
func LOptNumber(L *C.lua_State, narg int32, def lua_Number) lua_Number { func LOptNumber(L *LuaState, narg int32, def LuaNumber) LuaNumber {
return lua_Number(C.luaL_optnumber(L, C.int(narg), C.lua_Number(def))) return LuaNumber(C.luaL_optnumber(L, C.int(narg), C.lua_Number(def)))
} }
func LCheckBoolean(L *C.lua_State, narg int32) bool { func LCheckBoolean(L *LuaState, narg int32) bool {
return C.luaL_checkboolean(L, C.int(narg)) != 0 return C.luaL_checkboolean(L, C.int(narg)) != 0
} }
func LOptBoolean(L *C.lua_State, narg int32, def bool) bool { func LOptBoolean(L *LuaState, narg int32, def bool) bool {
cdef := C.int(0) cdef := C.int(0)
if def { if def {
cdef = C.int(1) cdef = C.int(1)
@ -102,64 +102,64 @@ func LOptBoolean(L *C.lua_State, narg int32, def bool) bool {
return C.luaL_optboolean(L, C.int(narg), cdef) != 0 return C.luaL_optboolean(L, C.int(narg), cdef) != 0
} }
func LCheckInteger(L *C.lua_State, narg int32) lua_Integer { func LCheckInteger(L *LuaState, narg int32) LuaInteger {
return lua_Integer(C.luaL_checkinteger(L, C.int(narg))) return LuaInteger(C.luaL_checkinteger(L, C.int(narg)))
} }
func LOptInteger(L *C.lua_State, narg int32, def lua_Integer) lua_Integer { func LOptInteger(L *LuaState, narg int32, def LuaInteger) LuaInteger {
return lua_Integer(C.luaL_optinteger(L, C.int(narg), C.lua_Integer(def))) return LuaInteger(C.luaL_optinteger(L, C.int(narg), C.lua_Integer(def)))
} }
func LCheckUnsigned(L *C.lua_State, narg int32) lua_Unsigned { func LCheckUnsigned(L *LuaState, narg int32) LuaUnsigned {
return lua_Unsigned(C.luaL_checkunsigned(L, C.int(narg))) return LuaUnsigned(C.luaL_checkunsigned(L, C.int(narg)))
} }
func LOptUnsigned(L *C.lua_State, narg int32, def lua_Unsigned) lua_Unsigned { func LOptUnsigned(L *LuaState, narg int32, def LuaUnsigned) LuaUnsigned {
return lua_Unsigned(C.luaL_optunsigned(L, C.int(narg), C.lua_Unsigned(def))) return LuaUnsigned(C.luaL_optunsigned(L, C.int(narg), C.lua_Unsigned(def)))
} }
func LCheckVector(L *C.lua_State, narg int32) *float32 { func LCheckVector(L *LuaState, narg int32) *float32 {
return (*float32)(C.luaL_checkvector(L, C.int(narg))) return (*float32)(C.luaL_checkvector(L, C.int(narg)))
} }
func LOptVector(L *C.lua_State, narg int32, def *float32) *float32 { func LOptVector(L *LuaState, narg int32, def *float32) *float32 {
return (*float32)(C.luaL_optvector(L, C.int(narg), (*C.float)(def))) return (*float32)(C.luaL_optvector(L, C.int(narg), (*C.float)(def)))
} }
func LCheckStack(L *C.lua_State, sz int32, msg string) { func LCheckStack(L *LuaState, sz int32, msg string) {
cmsg := C.CString(msg) cmsg := C.CString(msg)
defer C.free(unsafe.Pointer(cmsg)) defer C.free(unsafe.Pointer(cmsg))
C.luaL_checkstack(L, C.int(sz), cmsg) C.luaL_checkstack(L, C.int(sz), cmsg)
} }
func LCheckType(L *C.lua_State, narg int32, t int32) { func LCheckType(L *LuaState, narg int32, t int32) {
C.luaL_checktype(L, C.int(narg), C.int(t)) C.luaL_checktype(L, C.int(narg), C.int(t))
} }
func LCheckAny(L *C.lua_State, narg int32) { func LCheckAny(L *LuaState, narg int32) {
C.luaL_checkany(L, C.int(narg)) C.luaL_checkany(L, C.int(narg))
} }
func LNewMetatable(L *C.lua_State, tname string) bool { func LNewMetatable(L *LuaState, tname string) bool {
ctname := C.CString(tname) ctname := C.CString(tname)
defer C.free(unsafe.Pointer(ctname)) defer C.free(unsafe.Pointer(ctname))
return C.luaL_newmetatable(L, ctname) != 0 return C.luaL_newmetatable(L, ctname) != 0
} }
func LCheckUdata(L *C.lua_State, ud int32, tname string) unsafe.Pointer { func LCheckUdata(L *LuaState, ud int32, tname string) unsafe.Pointer {
ctname := C.CString(tname) ctname := C.CString(tname)
defer C.free(unsafe.Pointer(ctname)) defer C.free(unsafe.Pointer(ctname))
return C.luaL_checkudata(L, C.int(ud), ctname) return C.luaL_checkudata(L, C.int(ud), ctname)
} }
func LCheckBuffer(L *C.lua_State, narg int32, len *uint64) unsafe.Pointer { func LCheckBuffer(L *LuaState, narg int32, len *uint64) unsafe.Pointer {
return C.luaL_checkbuffer(L, C.int(narg), (*C.size_t)(len)) return C.luaL_checkbuffer(L, C.int(narg), (*C.size_t)(len))
} }
func LWhere(L *C.lua_State, lvl int32) { func LWhere(L *LuaState, lvl int32) {
C.luaL_where(L, C.int(lvl)) C.luaL_where(L, C.int(lvl))
} }
@ -167,14 +167,14 @@ func LWhere(L *C.lua_State, lvl int32) {
// expect the user to format the message and hand it over to us, which we // expect the user to format the message and hand it over to us, which we
// pass to luaL_errorL. This is an inconsistency with the actual C API, but // pass to luaL_errorL. This is an inconsistency with the actual C API, but
// there isn't really anything we can do. // there isn't really anything we can do.
func LErrorL(L *C.lua_State, msg string) { func LErrorL(L *LuaState, msg string) {
cmsg := C.CString(msg) cmsg := C.CString(msg)
defer C.free(unsafe.Pointer(cmsg)) defer C.free(unsafe.Pointer(cmsg))
C.cluaL_errorL(L, cmsg) C.cluaL_errorL(L, cmsg)
} }
func LCheckOption(L *C.lua_State, narg int32, def string, lst []string) int32 { func LCheckOption(L *LuaState, narg int32, def string, lst []string) int32 {
cdef := C.CString(def) cdef := C.CString(def)
defer C.free(unsafe.Pointer(cdef)) defer C.free(unsafe.Pointer(cdef))
@ -187,26 +187,26 @@ func LCheckOption(L *C.lua_State, narg int32, def string, lst []string) int32 {
return int32(C.luaL_checkoption(L, C.int(narg), cdef, clst)) return int32(C.luaL_checkoption(L, C.int(narg), cdef, clst))
} }
func LToLString(L *C.lua_State, idx int32, len *uint64) string { func LToLString(L *LuaState, idx int32, len *uint64) string {
p := C.luaL_tolstring(L, C.int(idx), (*C.size_t)(len)) p := C.luaL_tolstring(L, C.int(idx), (*C.size_t)(len))
defer C.free(unsafe.Pointer(p)) defer C.free(unsafe.Pointer(p))
return C.GoString(p) return C.GoString(p)
} }
func LNewState() *C.lua_State { func LNewState() *LuaState {
return C.luaL_newstate() return C.luaL_newstate()
} }
func LTypeName(L *C.lua_State, idx int32) string { func LTypeName(L *LuaState, idx int32) string {
return C.GoString(C.luaL_typename(L, C.int(idx))) return C.GoString(C.luaL_typename(L, C.int(idx)))
} }
func LSandbox(L *C.lua_State) { func LSandbox(L *LuaState) {
C.luaL_sandbox(L) C.luaL_sandbox(L)
} }
func LSandboxThread(L *C.lua_State) { func LSandboxThread(L *LuaState) {
C.luaL_sandboxthread(L) C.luaL_sandboxthread(L)
} }
@ -214,23 +214,23 @@ func LSandboxThread(L *C.lua_State) {
// Some useful macros // Some useful macros
// //
func LArgCheck(L *C.lua_State, cond bool, arg int32, extramsg string) { func LArgCheck(L *LuaState, cond bool, arg int32, extramsg string) {
if cond { if cond {
LArgError(L, arg, extramsg) LArgError(L, arg, extramsg)
} }
} }
func LArgExpected(L *C.lua_State, cond bool, arg int32, tname string) { func LArgExpected(L *LuaState, cond bool, arg int32, tname string) {
if cond { if cond {
LTypeError(L, arg, tname) LTypeError(L, arg, tname)
} }
} }
func LCheckString(L *C.lua_State, n int32) string { func LCheckString(L *LuaState, n int32) string {
return LCheckLString(L, n, nil) return LCheckLString(L, n, nil)
} }
func LOptString(L *C.lua_State, n int32, d string) string { func LOptString(L *LuaState, n int32, d string) string {
return LOptLString(L, n, d, nil) return LOptLString(L, n, d, nil)
} }

View file

@ -11,22 +11,23 @@ package internal
import "C" import "C"
import "unsafe" import "unsafe"
type lua_Number float64 type LuaNumber float64
type lua_Integer int32 type LuaInteger int32
type lua_Unsigned int32 type LuaUnsigned int32
type lua_CFunction func(L *C.lua_State) int32 type LuaState = C.lua_State
type lua_Continuation func(L *C.lua_State, status int32) int32 type LuaCFunction func(L *LuaState) int32
type LuaContinuation func(L *LuaState, status int32) int32
type lua_Udestructor = func(*C.void) type LuaUDestructor = func(*C.void)
type lua_Destructor = func(L *C.lua_State, _ unsafe.Pointer) type LuaDestructor = func(L *LuaState, _ unsafe.Pointer)
// type lua_Alloc = func(ud, ptr *C.void, osize, nsize C.size_t) *C.void // type LuaAlloc = func(ud, ptr *C.void, osize, nsize C.size_t) *C.void
type lua_Alloc = func(ptr unsafe.Pointer, osize, nsize uint64) unsafe.Pointer type LuaAlloc = func(ptr unsafe.Pointer, osize, nsize uint64) unsafe.Pointer
//export go_allocf //export go_allocf
func go_allocf(fp uintptr, ptr uintptr, osize uint64, nsize uint64) uintptr { func go_allocf(fp uintptr, ptr uintptr, osize uint64, nsize uint64) uintptr {
p := ((*((*lua_Alloc)(unsafe.Pointer(fp))))(unsafe.Pointer(ptr), osize, nsize)) p := ((*((*LuaAlloc)(unsafe.Pointer(fp))))(unsafe.Pointer(ptr), osize, nsize))
return uintptr(p) return uintptr(p)
} }
@ -36,27 +37,27 @@ func go_allocf(fp uintptr, ptr uintptr, osize uint64, nsize uint64) uintptr {
// ================== // ==================
// //
func NewState(ud unsafe.Pointer) *C.lua_State { func NewState(ud unsafe.Pointer) *LuaState {
return C.clua_newstate(unsafe.Pointer(ud)) return C.clua_newstate(unsafe.Pointer(ud))
} }
func LuaClose(L *C.lua_State) { func LuaClose(L *LuaState) {
C.lua_close(L) C.lua_close(L)
} }
func NewThread(L *C.lua_State) *C.lua_State { func NewThread(L *LuaState) *LuaState {
return C.lua_newthread(L) return C.lua_newthread(L)
} }
func MainThread(L *C.lua_State) *C.lua_State { func MainThread(L *LuaState) *LuaState {
return C.lua_mainthread(L) return C.lua_mainthread(L)
} }
func ResetThread(L *C.lua_State) { func ResetThread(L *LuaState) {
C.lua_resetthread(L) C.lua_resetthread(L)
} }
func IsThreadReset(L *C.lua_State) bool { func IsThreadReset(L *LuaState) bool {
return C.lua_isthreadreset(L) != 0 return C.lua_isthreadreset(L) != 0
} }
@ -66,47 +67,47 @@ func IsThreadReset(L *C.lua_State) bool {
// ================== // ==================
// //
func AbsIndex(L *C.lua_State, idx int32) int32 { func AbsIndex(L *LuaState, idx int32) int32 {
return int32(C.lua_absindex(L, C.int(idx))) return int32(C.lua_absindex(L, C.int(idx)))
} }
func GetTop(L *C.lua_State) int32 { func GetTop(L *LuaState) int32 {
return int32(C.lua_gettop(L)) return int32(C.lua_gettop(L))
} }
func SetTop(L *C.lua_State, idx int32) { func SetTop(L *LuaState, idx int32) {
C.lua_settop(L, C.int(idx)) C.lua_settop(L, C.int(idx))
} }
func PushValue(L *C.lua_State, idx int32) { func PushValue(L *LuaState, idx int32) {
C.lua_pushvalue(L, C.int(idx)) C.lua_pushvalue(L, C.int(idx))
} }
func Remove(L *C.lua_State, idx int32) { func Remove(L *LuaState, idx int32) {
C.lua_remove(L, C.int(idx)) C.lua_remove(L, C.int(idx))
} }
func Insert(L *C.lua_State, idx int32) { func Insert(L *LuaState, idx int32) {
C.lua_insert(L, C.int(idx)) C.lua_insert(L, C.int(idx))
} }
func Replace(L *C.lua_State, idx int32) { func Replace(L *LuaState, idx int32) {
C.lua_replace(L, C.int(idx)) C.lua_replace(L, C.int(idx))
} }
func CheckStack(L *C.lua_State, sz int32) bool { func CheckStack(L *LuaState, sz int32) bool {
return C.lua_checkstack(L, C.int(sz)) != 0 return C.lua_checkstack(L, C.int(sz)) != 0
} }
func RawCheckStack(L *C.lua_State, sz int32) { func RawCheckStack(L *LuaState, sz int32) {
C.lua_rawcheckstack(L, C.int(sz)) C.lua_rawcheckstack(L, C.int(sz))
} }
func XMove(from, to *C.lua_State, n int32) { func XMove(from, to *LuaState, n int32) {
C.lua_xmove(from, to, C.int(n)) C.lua_xmove(from, to, C.int(n))
} }
func XPush(from, to *C.lua_State, idx int32) { func XPush(from, to *LuaState, idx int32) {
C.lua_xpush(from, to, C.int(idx)) C.lua_xpush(from, to, C.int(idx))
} }
@ -116,139 +117,139 @@ func XPush(from, to *C.lua_State, idx int32) {
// ====================== // ======================
// //
func IsNumber(L *C.lua_State, idx int32) bool { func IsNumber(L *LuaState, idx int32) bool {
return C.lua_isnumber(L, C.int(idx)) != 0 return C.lua_isnumber(L, C.int(idx)) != 0
} }
func IsString(L *C.lua_State, idx int32) bool { func IsString(L *LuaState, idx int32) bool {
return C.lua_isstring(L, C.int(idx)) != 0 return C.lua_isstring(L, C.int(idx)) != 0
} }
func IsCFunction(L *C.lua_State, idx int32) bool { func IsCFunction(L *LuaState, idx int32) bool {
return C.lua_iscfunction(L, C.int(idx)) != 0 return C.lua_iscfunction(L, C.int(idx)) != 0
} }
func IsLFunction(L *C.lua_State, idx int32) bool { func IsLFunction(L *LuaState, idx int32) bool {
return C.lua_isLfunction(L, C.int(idx)) != 0 return C.lua_isLfunction(L, C.int(idx)) != 0
} }
func IsUserData(L *C.lua_State, idx int32) bool { func IsUserData(L *LuaState, idx int32) bool {
return C.lua_isuserdata(L, C.int(idx)) != 0 return C.lua_isuserdata(L, C.int(idx)) != 0
} }
func Type(L *C.lua_State, idx int32) bool { func Type(L *LuaState, idx int32) bool {
return C.lua_type(L, C.int(idx)) != 0 return C.lua_type(L, C.int(idx)) != 0
} }
func TypeName(L *C.lua_State, tp int32) string { func TypeName(L *LuaState, tp int32) string {
return C.GoString(C.lua_typename(L, C.int(tp))) return C.GoString(C.lua_typename(L, C.int(tp)))
} }
func Equal(L *C.lua_State, idx1, idx2 int32) bool { func Equal(L *LuaState, idx1, idx2 int32) bool {
return C.lua_equal(L, C.int(idx1), C.int(idx2)) != 0 return C.lua_equal(L, C.int(idx1), C.int(idx2)) != 0
} }
func RawEqual(L *C.lua_State, idx1, idx2 int32) bool { func RawEqual(L *LuaState, idx1, idx2 int32) bool {
return C.lua_rawequal(L, C.int(idx1), C.int(idx2)) != 0 return C.lua_rawequal(L, C.int(idx1), C.int(idx2)) != 0
} }
func LessThan(L *C.lua_State, idx1, idx2 int32) bool { func LessThan(L *LuaState, idx1, idx2 int32) bool {
return C.lua_lessthan(L, C.int(idx1), C.int(idx2)) != 0 return C.lua_lessthan(L, C.int(idx1), C.int(idx2)) != 0
} }
func ToNumberX(L *C.lua_State, idx int32, isnum bool) lua_Number { func ToNumberX(L *LuaState, idx int32, isnum bool) LuaNumber {
isnumInner := C.int(0) isnumInner := C.int(0)
if isnum { if isnum {
isnumInner = C.int(1) isnumInner = C.int(1)
} }
return lua_Number(C.lua_tonumberx(L, C.int(idx), &isnumInner)) return LuaNumber(C.lua_tonumberx(L, C.int(idx), &isnumInner))
} }
func ToIntegerX(L *C.lua_State, idx int32, isnum bool) lua_Integer { func ToIntegerX(L *LuaState, idx int32, isnum bool) LuaInteger {
isnumInner := C.int(0) isnumInner := C.int(0)
if isnum { if isnum {
isnumInner = C.int(1) isnumInner = C.int(1)
} }
return lua_Integer(C.lua_tointegerx(L, C.int(idx), &isnumInner)) return LuaInteger(C.lua_tointegerx(L, C.int(idx), &isnumInner))
} }
func ToUnsignedX(L *C.lua_State, idx int32, isnum bool) lua_Unsigned { func ToUnsignedX(L *LuaState, idx int32, isnum bool) LuaUnsigned {
isnumInner := C.int(0) isnumInner := C.int(0)
if isnum { if isnum {
isnumInner = C.int(1) isnumInner = C.int(1)
} }
return lua_Unsigned(C.lua_tounsignedx(L, C.int(idx), &isnumInner)) return LuaUnsigned(C.lua_tounsignedx(L, C.int(idx), &isnumInner))
} }
func ToVector(L *C.lua_State, idx int32) { func ToVector(L *LuaState, idx int32) {
C.lua_tovector(L, C.int(idx)) C.lua_tovector(L, C.int(idx))
} }
func ToBoolean(L *C.lua_State, idx int32) bool { func ToBoolean(L *LuaState, idx int32) bool {
return C.lua_toboolean(L, C.int(idx)) != 0 return C.lua_toboolean(L, C.int(idx)) != 0
} }
func ToLString(L *C.lua_State, idx int32, len *uint64) string { func ToLString(L *LuaState, idx int32, len *uint64) string {
return C.GoString(C.lua_tolstring(L, C.int(idx), (*C.size_t)(len))) return C.GoString(C.lua_tolstring(L, C.int(idx), (*C.size_t)(len)))
} }
func ToStringAtom(L *C.lua_State, idx int32, atom *int32) string { func ToStringAtom(L *LuaState, idx int32, atom *int32) string {
return C.GoString(C.lua_tostringatom(L, C.int(idx), (*C.int)(atom))) return C.GoString(C.lua_tostringatom(L, C.int(idx), (*C.int)(atom)))
} }
func NameCallAtom(L *C.lua_State, atom *int32) string { func NameCallAtom(L *LuaState, atom *int32) string {
return C.GoString(C.lua_namecallatom(L, (*C.int)(atom))) return C.GoString(C.lua_namecallatom(L, (*C.int)(atom)))
} }
func ObjLen(L *C.lua_State, idx int32) uint64 { func ObjLen(L *LuaState, idx int32) uint64 {
return uint64(C.lua_objlen(L, C.int(idx))) return uint64(C.lua_objlen(L, C.int(idx)))
} }
func ToCFunction(L *C.lua_State, idx int32) lua_CFunction { func ToCFunction(L *LuaState, idx int32) LuaCFunction {
p := unsafe.Pointer(C.lua_tocfunction(L, C.int(idx))) p := unsafe.Pointer(C.lua_tocfunction(L, C.int(idx)))
if p == C.NULL { if p == C.NULL {
return nil return nil
} }
return *(*lua_CFunction)(p) return *(*LuaCFunction)(p)
} }
func ToLightUserdata(L *C.lua_State, idx int32) unsafe.Pointer { func ToLightUserdata(L *LuaState, idx int32) unsafe.Pointer {
return unsafe.Pointer(C.lua_tolightuserdata(L, C.int(idx))) return unsafe.Pointer(C.lua_tolightuserdata(L, C.int(idx)))
} }
func ToLightUserdataTagged(L *C.lua_State, idx int32, tag int32) unsafe.Pointer { func ToLightUserdataTagged(L *LuaState, idx int32, tag int32) unsafe.Pointer {
return unsafe.Pointer(C.lua_tolightuserdatatagged(L, C.int(idx), C.int(tag))) return unsafe.Pointer(C.lua_tolightuserdatatagged(L, C.int(idx), C.int(tag)))
} }
func ToUserdata(L *C.lua_State, idx int32) unsafe.Pointer { func ToUserdata(L *LuaState, idx int32) unsafe.Pointer {
return unsafe.Pointer(C.lua_touserdata(L, C.int(idx))) return unsafe.Pointer(C.lua_touserdata(L, C.int(idx)))
} }
func ToUserdataTagged(L *C.lua_State, idx int32, tag int32) unsafe.Pointer { func ToUserdataTagged(L *LuaState, idx int32, tag int32) unsafe.Pointer {
return unsafe.Pointer(C.lua_touserdatatagged(L, C.int(idx), C.int(tag))) return unsafe.Pointer(C.lua_touserdatatagged(L, C.int(idx), C.int(tag)))
} }
func UserdataTag(L *C.lua_State, idx int32) int32 { func UserdataTag(L *LuaState, idx int32) int32 {
return int32(C.lua_userdatatag(L, C.int(idx))) return int32(C.lua_userdatatag(L, C.int(idx)))
} }
func LightUserdataTag(L *C.lua_State, idx int32) int32 { func LightUserdataTag(L *LuaState, idx int32) int32 {
return int32(C.lua_lightuserdatatag(L, C.int(idx))) return int32(C.lua_lightuserdatatag(L, C.int(idx)))
} }
func ToThread(L *C.lua_State, idx int32) *C.lua_State { func ToThread(L *LuaState, idx int32) *LuaState {
return C.lua_tothread(L, C.int(idx)) return C.lua_tothread(L, C.int(idx))
} }
func ToBuffer(L *C.lua_State, idx int32, len *uint64) unsafe.Pointer { func ToBuffer(L *LuaState, idx int32, len *uint64) unsafe.Pointer {
return unsafe.Pointer(C.lua_tobuffer(L, C.int(idx), (*C.size_t)(len))) return unsafe.Pointer(C.lua_tobuffer(L, C.int(idx), (*C.size_t)(len)))
} }
func ToPointer(L *C.lua_State, idx int32) unsafe.Pointer { func ToPointer(L *LuaState, idx int32) unsafe.Pointer {
return unsafe.Pointer(C.lua_topointer(L, C.int(idx))) return unsafe.Pointer(C.lua_topointer(L, C.int(idx)))
} }
@ -256,18 +257,52 @@ func ToPointer(L *C.lua_State, idx int32) unsafe.Pointer {
// Stack Manipulation // Stack Manipulation
// ======================= // =======================
func PushNil(L *C.lua_State) { func PushNil(L *LuaState) {
C.lua_pushnil(L) C.lua_pushnil(L)
} }
func PushNumber(L *C.lua_State, n lua_Number) { func PushNumber(L *LuaState, n LuaNumber) {
C.lua_pushnumber(L, C.lua_Number(n)) C.lua_pushnumber(L, C.lua_Number(n))
} }
func PushInteger(L *C.lua_State, n lua_Integer) { func PushInteger(L *LuaState, n LuaInteger) {
C.lua_pushinteger(L, C.lua_Integer(n)) C.lua_pushinteger(L, C.lua_Integer(n))
} }
// TODO: Vector 3 & 4 func PushUnsigned(L *LuaState, n LuaUnsigned) {
C.lua_pushunsigned(L, C.lua_Unsigned(n))
}
func PushLString(L *LuaState, s string, l uint64) {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
C.lua_pushlstring(L, cs, C.size_t(l))
}
func PushString(L *LuaState, s string) {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
C.lua_pushstring(L, cs)
}
// NOTE: We can't have lua_pushfstringL, since varadic
// arguments from Go->C isn't something that is possible.
// func PushFStringL(L *lua_State, fmt string) {}
func PushCClosureK(L *LuaState, f LuaCFunction, debugname string, nup int32, cont LuaContinuation) {
cdebugname := C.CString(debugname)
defer C.free(unsafe.Pointer(cdebugname))
var ccont unsafe.Pointer
if cont == nil {
ccont = C.NULL
} else {
ccont = unsafe.Pointer(&cont)
}
C.clua_pushcclosurek(L, unsafe.Pointer(&f), cdebugname, C.int(nup), ccont)
}
// TODO: Rest of it // TODO: Rest of it

View file

@ -9,6 +9,6 @@ package internal
*/ */
import "C" import "C"
func PushVector(L *C.lua_State, x float32, y float32, z float32) { func PushVector(L *LuaState, x float32, y float32, z float32) {
C.lua_pushvector(L, C.float(x), C.float(y), C.float(z)) C.lua_pushvector(L, C.float(x), C.float(y), C.float(z))
} }

View file

@ -9,6 +9,6 @@ package internal
*/ */
import "C" import "C"
func PushVector(L *C.lua_State, x float32, y float32, z float32, w float32) { func PushVector(L *LuaState, x float32, y float32, z float32, w float32) {
C.lua_pushvector(L, C.float(x), C.float(y), C.float(z), C.float(w)) C.lua_pushvector(L, C.float(x), C.float(y), C.float(z), C.float(w))
} }

View file

@ -1,9 +1,13 @@
package main package main
import "github.com/CompeyDev/lei/internal" import lualib "github.com/CompeyDev/lei/internal"
func main() { func main() {
lua := internal.LNewState() lua := lualib.LNewState()
lualib.PushCClosureK(lua, func(L *lualib.LuaState) int32 {
println("hi from closure? ")
return 0
}, "test", 0, nil)
println(lua) println(lua)
} }