MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / setpath

Function setpath

other_src/lua/src/loadlib.cpp:607–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605#define AUXMARK "\1"
606
607static void setpath (lua_State *L, const char *fieldname, const char *envname,
608 const char *def) {
609 const char *path = getenv(envname);
610 if (path == NULL) /* no environment variable? */
611 lua_pushstring(L, def); /* use default */
612 else {
613 /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
614 path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,
615 LUA_PATHSEP AUXMARK LUA_PATHSEP);
616 luaL_gsub(L, path, AUXMARK, def);
617 lua_remove(L, -2);
618 }
619 setprogdir(L);
620 lua_setfield(L, -2, fieldname);
621}
622
623
624static const luaL_Reg pk_funcs[] = {

Callers 1

luaopen_packageFunction · 0.70

Calls 5

lua_pushstringFunction · 0.70
luaL_gsubFunction · 0.70
lua_removeFunction · 0.70
setprogdirFunction · 0.70
lua_setfieldFunction · 0.70

Tested by

no test coverage detected