这篇教程C++ tolua_tostring函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tolua_tostring函数的典型用法代码示例。如果您正苦于以下问题:C++ tolua_tostring函数的具体用法?C++ tolua_tostring怎么用?C++ tolua_tostring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tolua_tostring函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: tolua_CCGLProgram_CCGLProgram_addAttribute00static int tolua_CCGLProgram_CCGLProgram_addAttribute00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCGLProgram",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isnumber(tolua_S,3,0,&tolua_err) || !tolua_isnoobj(tolua_S,4,&tolua_err) ) goto tolua_lerror; else#endif { CCGLProgram* self = (CCGLProgram*) tolua_tousertype(tolua_S,1,0); const char* attributeName = ((const char*) tolua_tostring(tolua_S,2,0)); unsigned int index = ((unsigned int) tolua_tonumber(tolua_S,3,0));#ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'addAttribute'", NULL);#endif { self->addAttribute(attributeName,index); } } return 0;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'addAttribute'.",&tolua_err); return 0;#endif}
开发者ID:imuzi,项目名称:MyApp,代码行数:31,
示例2: tolua_LuaAPI_Global_setDataRootDirectory00/* method: setDataRootDirectory of class Global */static int tolua_LuaAPI_Global_setDataRootDirectory00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"Global",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else#endif { Global* self = (Global*) tolua_tousertype(tolua_S,1,0); const char* s = ((const char*) tolua_tostring(tolua_S,2,0));#ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setDataRootDirectory'",NULL);#endif { self->setDataRootDirectory(s); } } return 0;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'setDataRootDirectory'.",&tolua_err); return 0;#endif}
开发者ID:cpzhang,项目名称:zen,代码行数:30,
示例3: Lockbool cPlugin_NewLua::OnChat(cPlayer * a_Player, AString & a_Message){ cCSLock Lock(m_CriticalSection); const char * FnName = GetHookFnName(cPluginManager::HOOK_CHAT); ASSERT(FnName != NULL); if (!PushFunction(FnName)) { return false; } tolua_pushusertype(m_LuaState, a_Player, "cPlayer"); tolua_pushstring (m_LuaState, a_Message.c_str()); if (!CallFunction(2, 2, FnName)) { return false; } bool bRetVal = (tolua_toboolean(m_LuaState, -2, 0) > 0); if (lua_isstring(m_LuaState, -1)) { a_Message = tolua_tostring(m_LuaState, -1, ""); } lua_pop(m_LuaState, 2); return bRetVal;}
开发者ID:l0ud,项目名称:MCServer,代码行数:26,
示例4: tolua_region_set_resourcestatic int tolua_region_set_resource(lua_State * L){ region *r = (region *) tolua_tousertype(L, 1, 0); const char *type = tolua_tostring(L, 2, 0); int result, value = (int)tolua_tonumber(L, 3, 0); critbit_tree * cb = special_resources(); const void * matches; if (cb_find_prefix(cb, type, strlen(type)+1, &matches, 1, 0)) { cb_get_kv(matches, &result, sizeof(result)); switch (result) { case 0: case 1: case 2: rsettrees(r, result, value); break; case 3: deathcounts(r, value - deathcount(r)); break; case 4: chaoscounts(r, value - chaoscount(r)); break; } } else { const resource_type *rtype = rt_find(type); if (rtype != NULL) { region_setresource(r, rtype, value); } } return 0;}
开发者ID:TomBraun,项目名称:server,代码行数:31,
示例5: tolua_CCGUI_CCValue_putString00static int tolua_CCGUI_CCValue_putString00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCValue",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else#endif { CCValue* self = (CCValue*) tolua_tousertype(tolua_S,1,0); const char* s = ((const char*) tolua_tostring(tolua_S,2,0));#ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'putString'", NULL);#endif { self->putString(s); } } return 0;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'putString'.",&tolua_err); return 0;#endif}
开发者ID:JoeHu,项目名称:ccgui,代码行数:29,
示例6: tolua_Label_Label_create00static int tolua_Label_Label_create00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertable(tolua_S,1,"Label",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isnumber(tolua_S,3,0,&tolua_err) || !tolua_isnoobj(tolua_S,4,&tolua_err) ) goto tolua_lerror; else#endif { const char* label = ((const char*) tolua_tostring(tolua_S,2,0)); FontSize size = ((FontSize) (int) tolua_tonumber(tolua_S,3,0)); { Label* tolua_ret = (Label*) Label::create(label,size); tolua_pushusertype(tolua_S,(void*)tolua_ret,"Label"); } } return 1;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'create'.",&tolua_err); return 0;#endif}
开发者ID:1179432578,项目名称:cocos2dx-2.2.2-test,代码行数:28,
示例7: lua_ftk_popup_menu_createstatic int lua_ftk_popup_menu_create(lua_State* L){ tolua_Error err = {0}; FtkPopupMenu* retv; int x; int y; int w; int h; FtkBitmap* icon; const char* title; int param_ok = tolua_isnumber(L, 1, 0, &err) && tolua_isnumber(L, 2, 0, &err) && tolua_isnumber(L, 3, 0, &err) && tolua_isnumber(L, 4, 0, &err) && tolua_isusertype(L, 5, "FtkBitmap", 0, &err) && tolua_isstring(L, 6, 0, &err); return_val_if_fail(param_ok, 0); x = tolua_tonumber(L, 1, 0); y = tolua_tonumber(L, 2, 0); w = tolua_tonumber(L, 3, 0); h = tolua_tonumber(L, 4, 0); icon = tolua_tousertype(L, 5, 0); title = tolua_tostring(L, 6, 0); retv = ftk_popup_menu_create(x, y, w, h, icon, title); tolua_pushusertype(L, (FtkPopupMenu*)retv, "FtkPopupMenu"); return 1;}
开发者ID:bbw2008good,项目名称:ftk,代码行数:25,
示例8: tolua_PlayerData_PlayerData_setName00static int tolua_PlayerData_PlayerData_setName00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"PlayerData",0,&tolua_err) || !tolua_isstring(tolua_S,2,0,&tolua_err) || !tolua_isnoobj(tolua_S,3,&tolua_err) ) goto tolua_lerror; else#endif { PlayerData* self = (PlayerData*) tolua_tousertype(tolua_S,1,0); char* _name = ((char*) tolua_tostring(tolua_S,2,0));#ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setName'", NULL);#endif { self->setName(_name); } } return 0;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'setName'.",&tolua_err); return 0;#endif}
开发者ID:gatewen,项目名称:Lua_Example,代码行数:29,
示例9: entity_GetPropertystatic int entity_GetProperty(lua_State *L){ int n = lua_gettop(L); if (n != 2) { return luaL_error(L, "Entity::GetProperty(name) requires 1 parameter."); } Entity *entity = (Entity *)tolua_tousertype(L, 1, 0); const char *propName = tolua_tostring(L, 2, 0); const char *str; float f; bool b; Rect *r; Vector *v; if (entity->GetProperty(propName, str)) { lua_pushstring(L, str); return 1; } else if (entity->GetProperty(propName, f)) { lua_pushnumber(L, f); return 1; } else if (entity->GetProperty(propName, b)) { lua_pushboolean(L, b); return 1; } else if (entity->GetProperty(propName, r)) { tolua_pushusertype(L, (void*)r, "Rect"); return 1; } else if (entity->GetProperty(propName, v)) { tolua_pushusertype(L, (void*)v, "Vector"); return 1; } else { lua_pushnil(L); return 1; }}
开发者ID:EddieRingle,项目名称:cerberus,代码行数:33,
示例10: tolua_config_eressea_config_parse00/* function: config_parse */static int tolua_config_eressea_config_parse00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isstring(tolua_S,1,0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else#endif { const char* json = ((const char*) tolua_tostring(tolua_S,1,0)); { int tolua_ret = (int) config_parse(json); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'parse'.",&tolua_err); return 0;#endif}
开发者ID:CTD1,项目名称:eressea-server-bugfixing,代码行数:26,
示例11: tolua_game_eressea_game_write00/* function: eressea_write_game */static int tolua_game_eressea_game_write00(lua_State* tolua_S){#ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isstring(tolua_S,1,0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else#endif { const char* filename = ((const char*) tolua_tostring(tolua_S,1,0)); { int tolua_ret = (int) eressea_write_game(filename); tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } return 1;#ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'write'.",&tolua_err); return 0;#endif}
开发者ID:ennorehling,项目名称:eressea,代码行数:26,
示例12: tolua_region_createstatic int tolua_region_create(lua_State * L){ int x = (int)tolua_tonumber(L, 1, 0); int y = (int)tolua_tonumber(L, 2, 0); const char *tname = tolua_tostring(L, 3, 0); if (tname) { plane *pl = findplane(x, y); const terrain_type *terrain = get_terrain(tname); region *r, *result; if (!terrain) { return 0; } assert(!pnormalize(&x, &y, pl)); r = result = findregion(x, y); if (terrain == NULL && r != NULL && r->units != NULL) { /* TODO: error message */ result = NULL; } else if (r == NULL) { result = new_region(x, y, pl, 0); } if (result) { terraform_region(result, terrain); } fix_demand(result); tolua_pushusertype(L, result, TOLUA_CAST "region"); return 1; } return 0;}
开发者ID:TomBraun,项目名称:server,代码行数:32,
示例13: tolua_bnd_cast/* Type casting*/static int tolua_bnd_cast (lua_State* L){/* // old code void* v = tolua_tousertype(L,1,NULL); const char* s = tolua_tostring(L,2,NULL); if (v && s) tolua_pushusertype(L,v,s); else lua_pushnil(L); return 1;*/ void* v; const char* s; if (lua_islightuserdata(L, 1)) { v = tolua_touserdata(L, 1, NULL); } else { v = tolua_tousertype(L, 1, 0); }; s = tolua_tostring(L,2,NULL); if (v && s) tolua_pushusertype(L,v,s); else lua_pushnil(L); return 1;}
开发者ID:tung,项目名称:quipkit,代码行数:30,
示例14: tolua_cocos2d_CCBProxy_readCCBFromFilestatic int tolua_cocos2d_CCBProxy_readCCBFromFile(lua_State* tolua_S){ if (NULL == tolua_S) return 0; int argc = 0; CCBProxy* self = nullptr; const char* ccbFilePath = nullptr; CCBReader* ccbReader = nullptr; bool setOwner = false; Node* tolua_ret = nullptr; int ID = 0; int* luaID = nullptr; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; if (!tolua_isusertype(tolua_S,1,"cc.CCBProxy",0,&tolua_err)) goto tolua_lerror;#endif self = static_cast<CCBProxy*>(tolua_tousertype(tolua_S,1,0)); #if COCOS2D_DEBUG >= 1 if (nullptr == self) { tolua_error(tolua_S,"invalid 'self' in function 'tolua_cocos2d_CCBProxy_readCCBFromFile'/n", NULL); return 0; }#endif argc = lua_gettop(tolua_S) - 1; if (2 == argc || 3 == argc) {#if COCOS2D_DEBUG >= 1 if (!tolua_isstring(tolua_S, 2, 0, &tolua_err)|| !tolua_isusertype(tolua_S,3,"cc.CCBReader",0,&tolua_err)|| !tolua_isboolean(tolua_S,4,1,&tolua_err ) ) goto tolua_lerror;#endif ccbFilePath = ((const char*) tolua_tostring(tolua_S,2,0)); ccbReader = ((CCBReader*) tolua_tousertype(tolua_S,3,0)); setOwner = (bool) tolua_toboolean(tolua_S,4,-1); tolua_ret = (Node*) self->readCCBFromFile(ccbFilePath, ccbReader, setOwner); ID = (tolua_ret) ? (int)tolua_ret->_ID : -1; luaID = (tolua_ret) ? &tolua_ret->_luaID : NULL; toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)tolua_ret,"cc.Node"); return 1; } CCLOG("%s function of CCBProxy has wrong number of arguments: %d, was expecting %d/n", "cc.CCBReader:readCCBFromFile", argc, 2); return 0; #if COCOS2D_DEBUG >= 1tolua_lerror: tolua_error(tolua_S,"#ferror in function 'tolua_cocos2d_CCBProxy_readCCBFromFile'.",&tolua_err); return 0;#endif}
开发者ID:AnySDK,项目名称:Sample_Lua,代码行数:59,
示例15: lua_ftk_translator_createstatic int lua_ftk_translator_create(lua_State* L){ tolua_Error err = {0}; FtkTranslator* retv; const char* package; const char* locale; int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err); return_val_if_fail(param_ok, 0); package = tolua_tostring(L, 1, 0); locale = tolua_tostring(L, 2, 0); retv = ftk_translator_create(package, locale); tolua_pushusertype(L, (FtkTranslator*)retv, "FtkTranslator"); return 1;}
开发者ID:bbw2008good,项目名称:ftk,代码行数:17,
示例16: tolua_faction_createstatic int tolua_faction_create(lua_State * L){ const char *email = tolua_tostring(L, 1, 0); const char *racename = tolua_tostring(L, 2, 0); const char *lang = tolua_tostring(L, 3, 0); struct locale *loc = get_locale(lang); faction *f = NULL; const struct race *frace = rc_find(racename); if (frace != NULL) { f = addfaction(email, NULL, frace, loc, 0); } if (!f) { log_error("faction.create(%s, %s, %s)/n", email, racename, lang); } tolua_pushusertype(L, f, TOLUA_CAST "faction"); return 1;}
开发者ID:Xolgrim,项目名称:server,代码行数:17,
示例17: tolua_faction_addnoticestatic int tolua_faction_addnotice(lua_State * L){ faction *self = (faction *)tolua_tousertype(L, 1, 0); const char *str = tolua_tostring(L, 2, 0); addmessage(NULL, self, str, MSG_MESSAGE, ML_IMPORTANT); return 0;}
开发者ID:Xolgrim,项目名称:server,代码行数:8,
示例18: lua_ftk_fs_movestatic int lua_ftk_fs_move(lua_State* L){ tolua_Error err = {0}; Ret retv; char* dir_from; char* dir_to; int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err); return_val_if_fail(param_ok, 0); dir_from = (char*)tolua_tostring(L, 1, 0); dir_to = (char*)tolua_tostring(L, 2, 0); retv = ftk_fs_move(dir_from, dir_to); tolua_pushnumber(L, (lua_Number)retv); return 1;}
开发者ID:htbegin,项目名称:pyftk,代码行数:17,
示例19: tolua_bnd_cast/* Type casting*/static int tolua_bnd_cast (lua_State* L){ void* v = tolua_tousertype(L,1,NULL); const char* s = tolua_tostring(L,2,NULL); if (v && s) tolua_pushusertype(L,v,s); else lua_pushnil(L); return 1;}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:12,
示例20: tolua_db_executestatic int tolua_db_execute(lua_State * L){ sqlite3 *db = (sqlite3 *)tolua_tousertype(L, 1, 0); const char *sql = tolua_tostring(L, 2, 0); int res = sqlite3_exec(db, sql, 0, 0, 0); tolua_pushnumber(L, (LUA_NUMBER)res); return 1;}
开发者ID:hochl,项目名称:server,代码行数:10,
示例21: lua_ftk_infomationstatic int lua_ftk_infomation(lua_State* L){ tolua_Error err = {0}; int retv; const char* title; const char* text; const char** buttons; int param_ok = tolua_isstring(L, 1, 0, &err) && tolua_isstring(L, 2, 0, &err) && tolua_istable(L, 3, 0, &err); return_val_if_fail(param_ok, 0); title = tolua_tostring(L, 1, 0); text = tolua_tostring(L, 2, 0); buttons = tolua_tostrings(L, 3, 0); retv = ftk_infomation(title, text, buttons); tolua_pushnumber(L, (lua_Number)retv); free(buttons); return 1;}
开发者ID:bbw2008good,项目名称:ftk,代码行数:20,
示例22: tolua_plane_set_namestatic int tolua_plane_set_name(lua_State * L){ plane *self = (plane *)tolua_tousertype(L, 1, 0); const char *str = tolua_tostring(L, 2, 0); free(self->name); if (str) self->name = _strdup(str); else self->name = 0; return 0;}
开发者ID:stm2,项目名称:server,代码行数:11,
示例23: tolua_db_createstatic int tolua_db_create(lua_State * L){ sqlite3 *db; const char *dbname = tolua_tostring(L, 1, 0); int result = sqlite3_open_v2(dbname, &db, SQLITE_OPEN_READWRITE, 0); if (result == SQLITE_OK) { tolua_pushusertype(L, (void *)db, LTYPE_DB); return 1; } return 0;}
开发者ID:hochl,项目名称:server,代码行数:11,
示例24: tolua_building_set_infostatic int tolua_building_set_info(lua_State * L){ building *self = (building *)tolua_tousertype(L, 1, 0); const char *info = tolua_tostring(L, 2, 0); free(self->display); if (info) self->display = _strdup(info); else self->display = NULL; return 0;}
开发者ID:philbooth,项目名称:server,代码行数:11,
示例25: tolua_faction_set_racestatic int tolua_faction_set_race(lua_State * L){ faction *self = (faction *)tolua_tousertype(L, 1, 0); const char *name = tolua_tostring(L, 2, 0); const race *rc = rc_find(name); if (rc != NULL) { self->race = rc; } return 0;}
开发者ID:Xolgrim,项目名称:server,代码行数:11,
示例26: tolua_make_blockstatic int tolua_make_block(lua_State * L){ int x = (int)tolua_tonumber(L, 1, 0); int y = (int)tolua_tonumber(L, 2, 0); int r = (int)tolua_tonumber(L, 3, 6); const char *str = tolua_tostring(L, 4, TOLUA_CAST "ocean"); const struct terrain_type *ter = get_terrain(str); make_block(x, y, r, ter); return 0;}
开发者ID:eressea,项目名称:server,代码行数:11,
注:本文中的tolua_tostring函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tolua_tousertype函数代码示例 C++ tolua_tonumber函数代码示例 |