Files
llgo/c/lua/lauxlib.go

102 lines
2.7 KiB
Go
Raw Normal View History

2024-06-27 18:19:45 +08:00
package lua
import (
_ "unsafe"
"github.com/goplus/llgo/c"
)
// /* global table */
// /* extra error code for 'luaL_loadfilex' */
// /* key, in the registry, for table of loaded modules */
// /* key, in the registry, for table of preloaded loaders */
// /* predefined references */
2024-06-30 19:35:45 +08:00
// llgo:link (*State).LoadFilex C.luaL_loadfilex
func (L *State) LoadFilex(filename *c.Char, mode *c.Char) c.Int { return 0 }
2024-06-27 18:19:45 +08:00
2024-06-30 19:35:45 +08:00
func (L *State) LoadFile(filename *c.Char) c.Int { return L.LoadFilex(filename, nil) }
2024-06-27 18:19:45 +08:00
2024-06-30 19:35:45 +08:00
// llgo:link (*State).LoadString C.luaL_loadstring
func (L *State) LoadString(s *c.Char) c.Int { return 0 }
2024-06-27 18:19:45 +08:00
//go:linkname NewState C.luaL_newstate
2024-06-30 19:35:45 +08:00
func NewState() *State
2024-06-27 18:19:45 +08:00
// /*
// ** ===============================================================
// ** some useful macros
// ** ===============================================================
// */
2024-06-30 19:35:45 +08:00
func (L *State) DoFile(filename *c.Char) c.Int {
2024-06-27 18:19:45 +08:00
if loadResult := L.LoadFile(filename); loadResult != 0 {
return loadResult
}
return L.PCall(c.Int(0), c.Int(MULTRET), c.Int(0))
}
2024-06-30 19:35:45 +08:00
func (L *State) DoString(str *c.Char) c.Int {
2024-06-27 18:19:45 +08:00
if loadResult := L.LoadString(str); loadResult != 0 {
return loadResult
}
return L.PCall(c.Int(0), c.Int(MULTRET), c.Int(0))
}
// /*
// ** Perform arithmetic operations on lua_Integer values with wrap-around
// ** semantics, as the Lua core does.
// */
// /* push the value used to represent failure/error */
// /*
// ** {======================================================
// ** Generic Buffer manipulation
// ** =======================================================
// */
// /* }====================================================== */
// /*
// ** {======================================================
// ** File handles for IO library
// ** =======================================================
// */
// /*
// ** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
// ** initial structure 'luaL_Stream' (it may contain other fields
// ** after that initial structure).
// */
// #define LUA_FILEHANDLE "FILE*"
// /* }====================================================== */
// /*
// ** {==================================================================
// ** "Abstraction Layer" for basic report of messages and errors
// ** ===================================================================
// */
// /* print a string */
// /* print a newline and flush the output */
// /* print an error message */
// /* }================================================================== */
// /*
// ** {============================================================
// ** Compatibility with deprecated conversions
// ** =============================================================
// */
// /* }============================================================ */