mirror of
https://github.com/vxcontrol/golua.git
synced 2026-06-30 22:17:55 -04:00
Merge branch 'master' of github.com:afitz/golua
Conflicts: lua51/golua.h
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
#include "_cgo_export.h"
|
||||
|
||||
//metatables to register:
|
||||
@@ -166,3 +167,33 @@ void clua_setallocf(lua_State* L, void* goallocf)
|
||||
{
|
||||
lua_setallocf(L,&allocwrapper,goallocf);
|
||||
}
|
||||
|
||||
void clua_openbase(lua_State* L){
|
||||
lua_pushcfunction(L,&luaopen_base);
|
||||
lua_call(L, 0, 0);
|
||||
}
|
||||
|
||||
void clua_openio(lua_State* L){
|
||||
lua_pushcfunction(L,&luaopen_io);
|
||||
lua_call(L, 0, 0);
|
||||
}
|
||||
|
||||
void clua_openmath(lua_State* L){
|
||||
lua_pushcfunction(L,&luaopen_math);
|
||||
lua_call(L, 0, 0);
|
||||
}
|
||||
|
||||
void clua_openpackage(lua_State* L){
|
||||
lua_pushcfunction(L,&luaopen_package);
|
||||
lua_call(L, 0, 0);
|
||||
}
|
||||
|
||||
void clua_openstring(lua_State* L){
|
||||
lua_pushcfunction(L,&luaopen_string);
|
||||
lua_call(L, 0, 0);
|
||||
}
|
||||
|
||||
void clua_opentable(lua_State* L){
|
||||
lua_pushcfunction(L,&luaopen_table);
|
||||
lua_call(L, 0, 0);
|
||||
}
|
||||
|
||||
@@ -12,3 +12,12 @@ GoInterface clua_atpanic(lua_State* L, unsigned int panicf_id);
|
||||
int clua_callluacfunc(lua_State* L, lua_CFunction f);
|
||||
lua_State* clua_newstate(void* goallocf);
|
||||
void clua_setallocf(lua_State* L, void* goallocf);
|
||||
|
||||
void clua_openbase(lua_State* L);
|
||||
void clua_openio(lua_State* L);
|
||||
void clua_openmath(lua_State* L);
|
||||
void clua_openpackage(lua_State* L);
|
||||
void clua_openstring(lua_State* L);
|
||||
void clua_opentable(lua_State* L);
|
||||
|
||||
|
||||
|
||||
@@ -477,5 +477,30 @@ func Yield(L *State, nresults int) int {
|
||||
return int(C.lua_yield(L.s, C.int(nresults)));
|
||||
}
|
||||
|
||||
// Restricted library opens
|
||||
|
||||
func OpenBase(L *State) {
|
||||
C.clua_openbase(L.s);
|
||||
}
|
||||
|
||||
func OpenIO(L *State) {
|
||||
C.clua_openio(L.s);
|
||||
}
|
||||
|
||||
func OpenMath(L *State) {
|
||||
C.clua_openmath(L.s);
|
||||
}
|
||||
|
||||
func OpenPackage(L *State) {
|
||||
C.clua_openpackage(L.s);
|
||||
}
|
||||
|
||||
func OpenString(L *State) {
|
||||
C.clua_openstring(L.s);
|
||||
}
|
||||
|
||||
func OpenTable(L *State) {
|
||||
C.clua_opentable(L.s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user