| 1015 | //============================================================================// |
| 1016 | |
| 1017 | int HubLink::SetBZDB(lua_State* L) { |
| 1018 | const std::string key = luaL_checkstring(L, 1); |
| 1019 | const std::string value = luaL_checkstring(L, 2); |
| 1020 | const bool usePersistent = lua_isboolean(L, 3); |
| 1021 | const bool isPersistent = usePersistent && lua_toboolean(L, 3); |
| 1022 | |
| 1023 | if (BZDB.isSet(key) && |
| 1024 | (BZDB.getPermission(key) == StateDatabase::Server)) { |
| 1025 | lua_pushboolean(L, false); |
| 1026 | return 1; |
| 1027 | } |
| 1028 | |
| 1029 | BZDB.set(key, value); |
| 1030 | |
| 1031 | if (usePersistent) { |
| 1032 | BZDB.setPersistent(key, isPersistent); |
| 1033 | } |
| 1034 | |
| 1035 | lua_pushboolean(L, true); |
| 1036 | return 1; |
| 1037 | } |
| 1038 | |
| 1039 | |
| 1040 | int HubLink::GetBZDB(lua_State* L) { |
nothing calls this directly
no test coverage detected