static int l_Entity_setName(lua_State* L) { auto entity = lua_toentity(L, 1); auto name = luaL_checkstring(L, 2); entity->setName(stringType(name)); return 0; }
SdpCandidate::SdpCandidateType SdpCandidate::getCandidateTypeFromString(const char * type) { UtlString stringType(type); if(stringType.compareTo("host", UtlString::ignoreCase) == 0) { return CANDIDATE_TYPE_HOST; } else if(stringType.compareTo("srflx", UtlString::ignoreCase) == 0) { return CANDIDATE_TYPE_SRFLX; } else if(stringType.compareTo("prflx", UtlString::ignoreCase) == 0) { return CANDIDATE_TYPE_PRFLX; } else if(stringType.compareTo("relay", UtlString::ignoreCase) == 0) { return CANDIDATE_TYPE_RELAY; } else { return CANDIDATE_TYPE_NONE; } }
stringType SDLFont::getFamilyStyle() { char * fontStyle = TTF_FontFaceStyleName(this->fontContext); if (fontStyle != NULL) { stringType fontStyleString = stringType(fontStyle); return fontStyle; } else { return "None"; } }
stringType SDLFont::getFamilyName() { char* fontFamily = TTF_FontFaceFamilyName(this->fontContext); if (fontFamily != NULL) { stringType fontFamilyString = stringType(fontFamily); return fontFamilyString; } else { return "None"; } }
boolType LuaScript::loadString(stringType theString, stringType name) { int error; error = luaL_loadbuffer(this->L, theString.c_str(), theString.size(), name.c_str()) || lua_pcall(L, 0, 0, 0); if (error) { auto errorMessage = stringType(lua_tostring(L, -1)); std::cerr << "LUA_ERROR: " << errorMessage << std::endl; std::cerr << "text-file: " << name << std::endl; lua_pop(L, 1); return false; } return true; }
static int l_Entity_getComponentsByFamily(lua_State* L) { auto entity = lua_toentity(L, 1); auto familyString = stringType(luaL_checkstring(L, 2)); partialComponentListType componentList; if (familyString == "ABSTRACT") { componentList = entity->getComponentsByFamily( enumComponentFamily::ABSTRACT); } else if (familyString == "COLLISION") { componentList = entity->getComponentsByFamily( enumComponentFamily::COLLISION); } else if (familyString == "PHYSICS") { componentList = entity->getComponentsByFamily( enumComponentFamily::PHYSICS); } else if (familyString == "GRAPHICS") { componentList = entity->getComponentsByFamily( enumComponentFamily::GRAPHICS); } else if (familyString == "CUSTOM") { componentList = entity->getComponentsByFamily( enumComponentFamily::CUSTOM); } else { luaL_error(L, "Incorrect family type"); } lua_createtable(L, componentList.size(), 0); int i = 0; for (auto component : componentList) { lua_pushcomponent(L, component); lua_rawseti(L, -2, i+1); i++; } return 1; }
SdpCandidate::SdpCandidateTransportType SdpCandidate::getCandidateTransportTypeFromString(const char * type) { UtlString stringType(type); if(stringType.compareTo("udp", UtlString::ignoreCase) == 0) { return CANDIDATE_TRANSPORT_TYPE_UDP; } else if(stringType.compareTo("tcp-so", UtlString::ignoreCase) == 0) { return CANDIDATE_TRANSPORT_TYPE_TCP_SO; } else if(stringType.compareTo("tcp-act", UtlString::ignoreCase) == 0) { return CANDIDATE_TRANSPORT_TYPE_TCP_ACT; } else if(stringType.compareTo("tcp-pass", UtlString::ignoreCase) == 0) { return CANDIDATE_TRANSPORT_TYPE_TCP_PASS; } else if(stringType.compareTo("tls-so", UtlString::ignoreCase) == 0) { return CANDIDATE_TRANSPORT_TYPE_TLS_SO; } else if(stringType.compareTo("tls-act", UtlString::ignoreCase) == 0) { return CANDIDATE_TRANSPORT_TYPE_TLS_ACT; } else if(stringType.compareTo("tls-pass", UtlString::ignoreCase) == 0) { return CANDIDATE_TRANSPORT_TYPE_TLS_PASS; } else { return CANDIDATE_TRANSPORT_TYPE_NONE; } }