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

Method ScriptGetCallInInfo

src/lua/LuaHandle.cpp:536–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534
535
536int LuaHandle::ScriptGetCallInInfo(lua_State* L) {
537 std::vector<std::string> list;
538 eventHandler.GetEventList(list);
539
540 const LuaCallInDB::InfoMap& ciInfoMap = luaCallInDB.GetInfoMap();
541 LuaCallInDB::InfoMap::const_iterator it;
542
543 if (lua_israwstring(L, 1)) {
544 const std::string ciName = lua_tostring(L, 1);
545 const bool wantAll = lua_isboolean(L, 2) && lua_tobool(L, 2);
546 if (wantAll || L2H(L)->CanUseCallIn(ciName)) {
547 it = ciInfoMap.find(ciName);
548 if (it != ciInfoMap.end()) {
549 PushCallInInfo(L, it->second);
550 }
551 }
552 else {
553 return luaL_pushnil(L);
554 }
555 }
556 else {
557 const bool wantAll = lua_isboolean(L, 1) && lua_tobool(L, 1);
558 lua_createtable(L, 0, ciInfoMap.size());
559 for (it = ciInfoMap.begin(); it != ciInfoMap.end(); ++it) {
560 const LuaCallInDB::CallInInfo& ciInfo = it->second;
561 if (wantAll || L2H(L)->CanUseCallIn(ciInfo.name)) {
562 lua_pushstring(L, ciInfo.name.c_str());
563 PushCallInInfo(L, ciInfo);
564 lua_rawset(L, -3);
565 }
566 }
567 }
568
569 return 1;
570}
571
572
573int LuaHandle::ScriptCanUseCallIn(lua_State* L) {

Callers

nothing calls this directly

Calls 15

lua_israwstringFunction · 0.85
lua_toboolFunction · 0.85
L2HFunction · 0.85
PushCallInInfoFunction · 0.85
luaL_pushnilFunction · 0.85
GetEventListMethod · 0.80
CanUseCallInMethod · 0.80
c_strMethod · 0.80
lua_createtableFunction · 0.50
lua_pushstringFunction · 0.50
lua_rawsetFunction · 0.50
findMethod · 0.45

Tested by

no test coverage detected