1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-05 18:41:05 +00:00

Use "core" namespace internally

This commit is contained in:
ShadowNinja 2014-04-27 21:02:48 -04:00
parent 1cd512913e
commit c4359ff65c
45 changed files with 812 additions and 843 deletions

View file

@ -146,7 +146,7 @@ void AsyncEngine::putJobResult(LuaJobInfo result)
/******************************************************************************/
void AsyncEngine::step(lua_State *L, int errorhandler)
{
lua_getglobal(L, "engine");
lua_getglobal(L, "core");
resultQueueMutex.Lock();
while (!resultQueue.empty()) {
LuaJobInfo jobDone = resultQueue.front();
@ -169,7 +169,7 @@ void AsyncEngine::step(lua_State *L, int errorhandler)
}
}
resultQueueMutex.Unlock();
lua_pop(L, 1); // Pop engine
lua_pop(L, 1); // Pop core
}
/******************************************************************************/
@ -223,17 +223,10 @@ AsyncWorkerThread::AsyncWorkerThread(AsyncEngine* jobDispatcher,
{
lua_State *L = getStack();
luaL_openlibs(L);
// Prepare job lua environment
lua_newtable(L);
lua_setglobal(L, "engine");
lua_getglobal(L, "engine");
lua_getglobal(L, "core");
int top = lua_gettop(L);
lua_pushstring(L, DIR_DELIM);
lua_setglobal(L, "DIR_DELIM");
// Push builtin initialization type
lua_pushstring(L, "async");
lua_setglobal(L, "INIT");
@ -278,9 +271,9 @@ void* AsyncWorkerThread::Thread()
continue;
}
lua_getglobal(L, "engine");
lua_getglobal(L, "core");
if (lua_isnil(L, -1)) {
errorstream << "Unable to find engine within async environment!";
errorstream << "Unable to find core within async environment!";
abort();
}
@ -310,7 +303,7 @@ void* AsyncWorkerThread::Thread()
toProcess.serializedResult = std::string(retval, length);
}
// Pop engine, job_processor, and retval
// Pop core, job_processor, and retval
lua_pop(L, 3);
// Put job result