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

Method SetBZDB

src/bzflag/HubLua.cpp:1017–1037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015//============================================================================//
1016
1017int 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
1040int HubLink::GetBZDB(lua_State* L) {

Callers

nothing calls this directly

Calls 6

isSetMethod · 0.80
getPermissionMethod · 0.80
setPersistentMethod · 0.80
lua_tobooleanFunction · 0.50
lua_pushbooleanFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected