static cxInt cxDataTypes(lua_State *L) { cxConstChars url = luaL_checkstring(L, 2); cxTypes types = cxEngineTypes(url); CX_LUA_PUSH_OBJECT(types); return 1; }
cxAny cxEngineDB(cxConstChars url) { cxTypes type = cxEngineTypes(url); if(type == NULL || type->any == NULL){ return NULL; } return cxTypesIsType(type, cxTypesDB) ? type->any : NULL; }
static cxInt cxDataString(lua_State *L) { cxConstChars url = luaL_checkstring(L, 2); cxTypes types = cxEngineTypes(url); if(types == NULL || !cxObjectIsType(types->any, cxStringTypeName)){ lua_pushnil(L); }else{ CX_LUA_PUSH_OBJECT(types->any); } return 1; }
cxString cxEngineLocalizedText(cxConstChars url) { cxEngine this = cxEngineInstance(); cxUrlPath path = cxUrlPathParse(url); cxTypes langTypes= cxEngineTypes("appConfig.xml?lang"); CX_ASSERT(langTypes != NULL, "appConfig.xml must set lang filed"); cxString dir = cxHashGet(langTypes->any, cxHashStrKey(cxStringBody(this->lang))); if(dir == NULL){ dir = cxHashFirst(langTypes->any); } CX_ASSERT(dir != NULL, "get lang dir error"); cxConstChars file = CX_CONST_STRING("%s/%s",cxStringBody(dir),path->path); cxTypes types = cxEngineTypes(CX_CONST_STRING("%s?%s",file,path->key)); CX_RETURN(types == NULL || !cxTypesIsType(types, cxTypesString), NULL); return types->any; }
static void cxPolygonReadAttr(cxReaderAttrInfo *info) { cxSpriteReadAttr(info); cxConstChars points = cxXMLAttr(info->reader, "cxPolygon.points"); CX_RETURN(points == NULL); cxTypes type = cxEngineTypes(points); CX_ASSERT(cxTypesIsType(type, cxTypesArray), "must is array"); cxArray list = type->any; CX_ARRAY_FOREACH(list, ele){ cxNumber bp = cxArrayObject(ele); cxPolygonAppend(info->object, cxNumberToPoint(bp)); }