MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / setpath

Function setpath

Source/Misc/lua/src/lua.c:13360–13374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13358#define AUXMARK "\1"
13359
13360static void setpath (lua_State *L, const char *fieldname, const char *envname,
13361const char *def) {
13362const char *path = getenv(envname);
13363if (path == NULL) /* no environment variable? */
13364lua_pushstring(L, def); /* use default */
13365else {
13366/* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
13367path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
13368LUA_PATHSEP AUXMARK LUA_PATHSEP);
13369luaL_gsub(L, path, AUXMARK, def);
13370lua_remove(L, -2);
13371}
13372setprogdir(L);
13373lua_setfield(L, -2, fieldname);
13374}
13375
13376
13377static const luaL_Reg pk_funcs[] = {

Callers 1

luaopen_packageFunction · 0.85

Calls 5

lua_pushstringFunction · 0.85
luaL_gsubFunction · 0.85
lua_removeFunction · 0.85
setprogdirFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected