int w_Thread_getName(lua_State *L) { Thread *t = luax_checkthread(L, 1); // allow names containing \0 luax_pushstring(L, t->getName()); return 1; }
int w_GlyphData_getGlyphString(lua_State *L) { GlyphData *t = luax_checkglyphdata(L, 1); luax_catchexcept(L, [&](){ luax_pushstring(L, t->getGlyphString()); }); return 1; }
int Message::toLua(lua_State *L) { luax_pushstring(L, name); for (int i = 0; i < nargs; i++) args[i]->toLua(L); return nargs+1; }
int w_getClipboardText(lua_State *L) { std::string text; luax_catchexcept(L, [&]() { text = instance()->getClipboardText(); }); luax_pushstring(L, text); return 1; }
int w_Thread_getError(lua_State *L) { LuaThread *t = luax_checkthread(L, 1); std::string err = t->getError(); if (err.empty()) lua_pushnil(L); else luax_pushstring(L, err); return 1; }
int w_Thread_getKeys(lua_State *L) { Thread *t = luax_checkthread(L, 1); t->lock(); std::vector<std::string> keys = t->getKeys(); t->unlock(); lua_createtable(L, keys.size(), 0); int i = 1; for (std::vector<std::string>::iterator it = keys.begin(); it != keys.end(); it++) { lua_pushnumber(L, i++); luax_pushstring(L, *it); lua_settable(L, -3); } return 1; }
int w_getRequirePath(lua_State *L) { std::stringstream path; bool seperator = false; for (auto &element : instance()->getRequirePath()) { if (seperator) path << ";"; else seperator = true; path << element; } luax_pushstring(L, path.str()); return 1; }
int w_getThreads(lua_State *L) { unsigned count = instance->getThreadCount(); Thread **list = new Thread*[count]; instance->getThreads(list); lua_newtable(L); for (unsigned int i = 0; i<count; i++) { // allow names containing \0 luax_pushstring(L, list[i]->getName()); luax_newtype(L, "Thread", THREAD_THREAD_T, (void*) list[i]); list[i]->lock(); list[i]->retain(); list[i]->unlock(); lua_settable(L, -3); } delete[] list; return 1; }
int w_File_getExtension(lua_State *L) { File *file = luax_checkfile(L, 1); luax_pushstring(L, file->getExtension()); return 1; }
int w_File_getFilename(lua_State *L) { File *file = luax_checkfile(L, 1); luax_pushstring(L, file->getFilename()); return 1; }
int w_getExecutablePath(lua_State *L) { luax_pushstring(L, instance()->getExecutablePath()); return 1; }
int w_getSourceBaseDirectory(lua_State *L) { luax_pushstring(L, instance()->getSourceBaseDirectory()); return 1; }
int w_getAppdataDirectory(lua_State *L) { luax_pushstring(L, instance()->getAppdataDirectory()); return 1; }
int w_getOS(lua_State *L) { luax_pushstring(L, instance()->getOS()); return 1; }
int w_Joystick_getGUID(lua_State *L) { Joystick *j = luax_checkjoystick(L, 1); luax_pushstring(L, j->getGUID()); return 1; }