mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-01 00:09:58 -05:00
Adapt to new Ghoul change with luaError
This commit is contained in:
@@ -58,7 +58,7 @@ int addDashboardItemToScreenSpace(lua_State* L) {
|
||||
const std::string& name = ghoul::lua::value<std::string>(L, 1);
|
||||
const int type = lua_type(L, 2);
|
||||
if (type != LUA_TTABLE) {
|
||||
return luaL_error(L, "Expected argument of type 'table'"); // NOLINT
|
||||
return ghoul::lua::luaError(L, "Expected argument of type 'table'");
|
||||
}
|
||||
|
||||
ghoul::Dictionary d;
|
||||
@@ -73,13 +73,15 @@ int addDashboardItemToScreenSpace(lua_State* L) {
|
||||
ScreenSpaceRenderable* ssr = OsEng.renderEngine().screenSpaceRenderable(name);
|
||||
|
||||
if (!ssr) {
|
||||
return luaL_error(L, "Provided name is not a ScreenSpace item"); // NOLINT
|
||||
return ghoul::lua::luaError(L, "Provided name is not a ScreenSpace item");
|
||||
}
|
||||
|
||||
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr);
|
||||
if (!dash) {
|
||||
// NOLINTNEXTLINE
|
||||
return luaL_error(L, "Provided name is a ScreenSpace item but not a dashboard");
|
||||
return ghoul::lua::luaError(
|
||||
L,
|
||||
"Provided name is a ScreenSpace item but not a dashboard"
|
||||
);
|
||||
}
|
||||
|
||||
dash->dashboard().addDashboardItem(DashboardItem::createFromDictionary(d));
|
||||
@@ -99,13 +101,15 @@ int removeDashboardItemsFromScreenSpace(lua_State* L) {
|
||||
ScreenSpaceRenderable* ssr = OsEng.renderEngine().screenSpaceRenderable(name);
|
||||
|
||||
if (!ssr) {
|
||||
return luaL_error(L, "Provided name is not a ScreenSpace item"); // NOLINT
|
||||
return ghoul::lua::luaError(L, "Provided name is not a ScreenSpace item");
|
||||
}
|
||||
|
||||
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr);
|
||||
if (!dash) {
|
||||
// NOLINTNEXTLINE
|
||||
return luaL_error(L, "Provided name is a ScreenSpace item but not a dashboard");
|
||||
return ghoul::lua::luaError(
|
||||
L,
|
||||
"Provided name is a ScreenSpace item but not a dashboard"
|
||||
);
|
||||
}
|
||||
|
||||
dash->dashboard().clearDashboardItems();
|
||||
|
||||
@@ -54,19 +54,19 @@ int addLayer(lua_State* L) {
|
||||
// Get the node and make sure it exists
|
||||
SceneGraphNode* n = OsEng.renderEngine().scene()->sceneGraphNode(globeName);
|
||||
if (!n) {
|
||||
return luaL_error(L, ("Unknown globe name: " + globeName).c_str());
|
||||
return ghoul::lua::luaError(L, "Unknown globe name: " + globeName);
|
||||
}
|
||||
|
||||
// Get the renderable globe
|
||||
const RenderableGlobe* globe = dynamic_cast<const RenderableGlobe*>(n->renderable());
|
||||
if (!globe) {
|
||||
return luaL_error(L, ("Renderable is not a globe: " + globeName).c_str());
|
||||
return ghoul::lua::luaError(L, "Renderable is not a globe: " + globeName);
|
||||
}
|
||||
|
||||
// Get the layer group
|
||||
layergroupid::GroupID groupID = layergroupid::getGroupIDFromName(layerGroupName);
|
||||
if (groupID == layergroupid::GroupID::Unknown) {
|
||||
return luaL_error(L, ("Unknown layer group: " + layerGroupName).c_str());
|
||||
return ghoul::lua::luaError(L, "Unknown layer group: " + layerGroupName);
|
||||
}
|
||||
|
||||
// Get the dictionary defining the layer
|
||||
@@ -104,19 +104,19 @@ int deleteLayer(lua_State* L) {
|
||||
// Get the node and make sure it exists
|
||||
SceneGraphNode* n = OsEng.renderEngine().scene()->sceneGraphNode(globeName);
|
||||
if (!n) {
|
||||
return luaL_error(L, ("Unknown globe name: " + globeName).c_str());
|
||||
return ghoul::lua::luaError(L, "Unknown globe name: " + globeName);
|
||||
}
|
||||
|
||||
// Get the renderable globe
|
||||
const RenderableGlobe* globe = dynamic_cast<const RenderableGlobe*>(n->renderable());
|
||||
if (!globe) {
|
||||
return luaL_error(L, ("Renderable is not a globe: " + globeName).c_str());
|
||||
return ghoul::lua::luaError(L, "Renderable is not a globe: " + globeName);
|
||||
}
|
||||
|
||||
// Get the layer group
|
||||
layergroupid::GroupID groupID = layergroupid::getGroupIDFromName(layerGroupName);
|
||||
if (groupID == layergroupid::GroupID::Unknown) {
|
||||
return luaL_error(L, ("Unknown layer group: " + layerGroupName).c_str());
|
||||
return ghoul::lua::luaError(L, "Unknown layer group: " + layerGroupName);
|
||||
}
|
||||
|
||||
globe->layerManager()->deleteLayer(groupID, layerName);
|
||||
@@ -174,11 +174,11 @@ int getGeoPosition(lua_State* L) {
|
||||
|
||||
SceneGraphNode* n = sceneGraphNode(name);
|
||||
if (!n) {
|
||||
return luaL_error(L, ("Unknown globe name: " + name).c_str());
|
||||
return ghoul::lua::luaError(L, "Unknown globe name: " + name);
|
||||
}
|
||||
const RenderableGlobe* globe = dynamic_cast<const RenderableGlobe*>(n->renderable());
|
||||
if (!globe) {
|
||||
return luaL_error(L, "Name must be a RenderableGlobe");
|
||||
return ghoul::lua::luaError(L, "Name must be a RenderableGlobe");
|
||||
}
|
||||
|
||||
GlobeBrowsingModule& mod = *(OsEng.moduleEngine().module<GlobeBrowsingModule>());
|
||||
@@ -201,7 +201,7 @@ int getGeoPositionForCamera(lua_State* L) {
|
||||
GlobeBrowsingModule* module = OsEng.moduleEngine().module<GlobeBrowsingModule>();
|
||||
const RenderableGlobe* globe = module->castFocusNodeRenderableToGlobe();
|
||||
if (!globe) {
|
||||
return luaL_error(L, "Focus node must be a RenderableGlobe");
|
||||
return ghoul::lua::luaError(L, "Focus node must be a RenderableGlobe");
|
||||
}
|
||||
|
||||
const glm::dvec3 cameraPosition = OsEng.navigationHandler().camera()->positionVec3();
|
||||
|
||||
@@ -57,7 +57,9 @@ int iswa_addScreenSpaceCygnet(lua_State* L) {
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1) {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
return ghoul::lua::luaError(L, fmt::format(
|
||||
"Expected {} argumemts, got {}", 1, nArguments
|
||||
));
|
||||
}
|
||||
|
||||
ghoul::Dictionary d;
|
||||
|
||||
Reference in New Issue
Block a user