-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
lua_getstack(L, 1, &ar);
lua_getinfo(L, "Sl", &ar);
- link.properties = nullptr;
-
lua_ensure(lua_istable(L, -1),"Bad Arguments to create backbone in Lua. Should be a table with named arguments.");
lua_pushstring(L, "id");
*/
lua_pushstring(L,"symmetrical");
lua_gettable(L,-2);
- if (lua_isstring(L, -1)) {
- const char* value = lua_tostring(L, -1);
- if (strcmp("YES", value) == 0)
- route.symmetrical = true;
- else
- route.symmetrical = false;
- }
- else {
- route.symmetrical = true;
- }
+ route.symmetrical = (not lua_isstring(L, -1) || strcasecmp("YES", lua_tostring(L, -1)) == 0);
lua_pop(L,1);
- route.gw_src = nullptr;
- route.gw_dst = nullptr;
-
sg_platf_new_route(&route);
return 0;
lua_pushstring(L,"symmetrical");
lua_gettable(L,-2);
- if (lua_isstring(L, -1)) {
- const char* value = lua_tostring(L, -1);
- if (strcmp("YES", value) == 0)
- ASroute.symmetrical = true;
- else
- ASroute.symmetrical = false;
- }
- else {
- ASroute.symmetrical = true;
- }
+ ASroute.symmetrical = (not lua_isstring(L, -1) || strcasecmp("YES", lua_tostring(L, -1)) == 0);
lua_pop(L,1);
sg_platf_new_route(&ASroute);