/* * Method: SectorOnly * * Derive a SystemPath that points to the whole sector. * * > sector_path = path:SectorOnly() * * Return: * * sector_path - the SystemPath that represents just the sector * * Availability: * * alpha 17 * * Status: * * stable */ static int l_sbodypath_sector_only(lua_State *l) { SystemPath *path = LuaObject<SystemPath>::CheckFromLua(1); if (path->IsSectorPath()) { return 1; } LuaObject<SystemPath>::PushToLua(path->SectorOnly()); return 1; }
/* * Method: ParseString * * Parse a string and try to make a SystemPath from it * * > sector_path = SystemPath.Parse() * * Return: * * sector_path - the SystemPath that represents just the sector * * Availability: * * 2018-06-16 * * Status: * * experimental */ static int l_sbodypath_parse_string(lua_State *l) { std::string path = LuaPull<std::string>(l, 1); try { SystemPath syspath = SystemPath::Parse(path.c_str()); LuaObject<SystemPath>::PushToLua(syspath.SectorOnly()); return 1; } catch (SystemPath::ParseFailure pf) { return 0; } return 0; }
/* * Method: SectorOnly * * Derive a SystemPath that points to the whole sector. * * > sector_path = path:SectorOnly() * * Return: * * sector_path - the SystemPath that represents just the sector * * Availability: * * alpha 17 * * Status: * * stable */ static int l_sbodypath_sector_only(lua_State *l) { SystemPath *path = LuaSystemPath::CheckFromLua(1); LuaSystemPath::PushToLuaGC(new SystemPath(path->SectorOnly())); return 1; }