mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
rewrite Lua handling
* depend pkg checks on enable-lua switch
* define STATIC_LUAPOSIX in case of static lua build to exclude unwanted
code in neutrino
* remove DYNAMIC_LUAPOSIX code as it's not needed in case of dynamic lua
build
Origin commit data
------------------
Branch: ni/coolstream
Commit: 4b6d2d310c
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2014-01-25 (Sat, 25 Jan 2014)
Origin message was:
------------------
- rewrite Lua handling
* depend pkg checks on enable-lua switch
* define STATIC_LUAPOSIX in case of static lua build to exclude unwanted
code in neutrino
* remove DYNAMIC_LUAPOSIX code as it's not needed in case of dynamic lua
build
------------------
This commit was generated by Migit
This commit is contained in:
committed by
Michael Liebmann
parent
4b79914d57
commit
ed048eebdd
@@ -347,35 +347,12 @@ const luaL_Reg CLuaInstance::methods[] =
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
#ifndef DYNAMIC_LUAPOSIX
|
||||
#ifdef STATIC_LUAPOSIX
|
||||
/* hack: we link against luaposix, which is included in our
|
||||
* custom built lualib */
|
||||
extern "C" { LUAMOD_API int (luaopen_posix_c) (lua_State *L); }
|
||||
#else
|
||||
static int dolibrary (lua_State *L, const char *name)
|
||||
{
|
||||
int status = 0;
|
||||
const char *msg = "";
|
||||
lua_getglobal(L, "require");
|
||||
lua_pushstring(L, name);
|
||||
status = lua_pcall(L, 1, 0, 0);
|
||||
if (status && !lua_isnil(L, -1))
|
||||
{
|
||||
msg = lua_tostring(L, -1);
|
||||
if (NULL == msg)
|
||||
{
|
||||
msg = "(error object is not a string)";
|
||||
}
|
||||
fprintf(stderr, "[CLuaInstance::%s] error in dolibrary: %s (%s)\n", __func__, name,msg);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("[CLuaInstance::%s] loaded library: %s\n", __func__, name);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* load basic functions and register our own C callbacks */
|
||||
void CLuaInstance::registerFunctions()
|
||||
{
|
||||
@@ -384,14 +361,6 @@ void CLuaInstance::registerFunctions()
|
||||
luaopen_io(lua);
|
||||
luaopen_string(lua);
|
||||
luaopen_math(lua);
|
||||
#ifndef DYNAMIC_LUAPOSIX
|
||||
#if !HAVE_COOL_HARDWARE
|
||||
luaopen_posix_c(lua);
|
||||
#endif
|
||||
#else
|
||||
dolibrary(lua,"posix");
|
||||
#endif
|
||||
|
||||
lua_newtable(lua);
|
||||
int methodtable = lua_gettop(lua);
|
||||
luaL_newmetatable(lua, className);
|
||||
|
Reference in New Issue
Block a user