• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setobj2s函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setobj2s函数的典型用法代码示例。如果您正苦于以下问题:C++ setobj2s函数的具体用法?C++ setobj2s怎么用?C++ setobj2s使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setobj2s函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: luaH_next

int luaH_next (lua_State *L, Table *t, StkId key) {
  int i = findindex(L, t, key);  /* find original element */
  for (i++; i < t->sizearray; i++) {  /* try first array part */
    if (!ttisnil(&t->array[i])) {  /* a non-nil value? */
      setnvalue(key, cast_num(i+1));
      setobj2s(L, key+1, &t->array[i]);
      return 1;
    }
  }
  for (i -= t->sizearray; i < sizenode(t); i++) {  /* then hash part */
    if (!ttisnil(gval(gnode(t, i)))) {  /* a non-nil value? */
      setobj2s(L, key, key2tval(gnode(t, i)));
      setobj2s(L, key+1, gval(gnode(t, i)));
      return 1;
    }
  }
  return 0;  /* no more elements */
}
开发者ID:DuMuT6p,项目名称:Epiar,代码行数:18,代码来源:ltable.c


示例2: revappendstack

/* Copies a stack, but the stack is reversed in the process
 */
static size_t revappendstack(lua_State *from, lua_State *to)
{
	StkId o;
	for(o=from->top-1; o>=from->stack; o--) {
		setobj2s(to, to->top, o);
		to->top++;
	}
	return from->top - from->stack;
}
开发者ID:duncanc,项目名称:Lua-for-AGS,代码行数:11,代码来源:pluto.vc.c


示例3: lua_rawget

LUA_API int lua_rawget (lua_State *L, int idx) {
  StkId t;
  lua_lock(L);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));
  lua_unlock(L);
  return ttnov(L->top - 1);
}
开发者ID:4Second2None,项目名称:skynet,代码行数:9,代码来源:lapi.c


示例4: do1gcTM

static void do1gcTM (lua_State *L, Udata *udata) {
  const TObject *tm = fasttm(L, udata->uv.metatable, TM_GC);
  if (tm != NULL) {
    setobj2s(L->top, tm);
    setuvalue(L->top+1, udata);
    L->top += 2;
    luaD_call(L, L->top - 2, 0);
  }
}
开发者ID:Amakata,项目名称:wajima-project,代码行数:9,代码来源:lgc.c


示例5: lua_rawgeti

LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
  StkId t;
  lua_lock(L);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  setobj2s(L, L->top, luaH_getint(hvalue(t), n));
  api_incr_top(L);
  lua_unlock(L);
}
开发者ID:shizgnit,项目名称:ApplicationTemplate,代码行数:9,代码来源:lapi.c


示例6: lua_rawgeti

LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
  StkId o;
  lua_lock(L);
  o = luaA_index(L, idx);
  api_check(L, ttistable(o));
  setobj2s(L->top, luaH_getnum(hvalue(o), n));
  api_incr_top(L);
  lua_unlock(L);
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:9,代码来源:lapi.c


示例7: lua_rawgeti

LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) {
  StkId t;
  lua_lock(L);
  t = index2addr(L, idx);
  api_check(ttistable(t), "table expected");
  setobj2s(L, L->top, luaH_getint(hvalue(t), n));
  api_incr_top(L);
  lua_unlock(L);
  return ttnov(L->top - 1);
}
开发者ID:1414648814,项目名称:ejoy2d,代码行数:10,代码来源:lapi.c


示例8: luaT_callTM

void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
                  const TValue *p2, TValue *p3, int hasres) {
  ptrdiff_t result = savestack(L, p3);
  StkId func = L->top;
  setobj2s(L, func, f);  /* push function (assume EXTRA_STACK) */
  setobj2s(L, func + 1, p1);  /* 1st argument */
  setobj2s(L, func + 2, p2);  /* 2nd argument */
  L->top += 3;
  if (!hasres)  /* no result? 'p3' is third argument */
    setobj2s(L, L->top++, p3);  /* 3rd argument */
  /* metamethod may yield only when called from Lua code */
  if (isLua(L->ci))
    luaD_call(L, func, hasres);
  else
    luaD_callnoyield(L, func, hasres);
  if (hasres) {  /* if has result, move it to its place */
    p3 = restorestack(L, result);
    setobjs2s(L, p3, --L->top);
  }
}
开发者ID:bcrist,项目名称:lua,代码行数:20,代码来源:ltm.c


示例9: luaH_next

int luaH_next (lua_State *L, Table *t, StkId key) {
  unsigned int asize = luaH_realasize(t);
  unsigned int i = findindex(L, t, s2v(key), asize);  /* find original key */
  for (; i < asize; i++) {  /* try first array part */
    if (!isempty(&t->array[i])) {  /* a non-empty entry? */
      setivalue(s2v(key), i + 1);
      setobj2s(L, key + 1, &t->array[i]);
      return 1;
    }
  }
  for (i -= asize; cast_int(i) < sizenode(t); i++) {  /* hash part */
    if (!isempty(gval(gnode(t, i)))) {  /* a non-empty entry? */
      Node *n = gnode(t, i);
      getnodekey(L, s2v(key), n);
      setobj2s(L, key + 1, gval(n));
      return 1;
    }
  }
  return 0;  /* no more elements */
}
开发者ID:luciouskami,项目名称:YDWE,代码行数:20,代码来源:ltable.c


示例10: callTM

/* 调用元操作
 * L 虚拟机状态
 * f 函数地址
 * p1 函数第一个参数
 * p2 函数第二个参数
 * p3 函数的第三个参数
 * hasres 是否存在第三个参数
 */
static void callTM (lua_State *L, const TValue *f, const TValue *p1,
                    const TValue *p2, TValue *p3, int hasres) {
  ptrdiff_t result = savestack(L, p3);                    /* 保存栈 */
  setobj2s(L, L->top++, f);  /* push function */          /* 元函数地址 */
  setobj2s(L, L->top++, p1);  /* 1st argument */          /* 参数1 */
  setobj2s(L, L->top++, p2);  /* 2nd argument */          /* 参数2 */
	/* 如果hasres是1则压入第三个参数 */
  if (!hasres)  /* no result? 'p3' is third argument */
    setobj2s(L, L->top++, p3);  /* 3rd argument */
  /* metamethod may yield only when called from Lua code */
	/* 当从lua代码中调用元方法也许被挂起 */
  luaD_call(L, L->top - (4 - hasres), hasres, isLua(L->ci));
	/* 
	 * 如果有第三个参数
	 */
  if (hasres) {  /* if has result, move it to its place */
    p3 = restorestack(L, result);
    setobjs2s(L, p3, --L->top);
  }
}
开发者ID:devilogic,项目名称:xlua,代码行数:28,代码来源:lvm.c


示例11: lua_xmove

/* weet:
 * 将一个栈顶的n个元素拷贝到另一个栈
 * */
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
  int i;
  lua_lock(to);
  api_checknelems(from, n);
  from->top -= n;
  for (i = 0; i < n; i++) {
    setobj2s(to->top, from->top + i);
    api_incr_top(to);
  }
  lua_unlock(to);
}
开发者ID:TheWaWaR,项目名称:my-lua5.0,代码行数:14,代码来源:lapi.c


示例12: lua_rawgetp

LUA_API void lua_rawgetp (lua_State *L, int idx, const void *p) {
  StkId t;
  TValue k;
  lua_lock(L);
  t = index2addr(L, idx);
  api_check(L, ttistable(t), "table expected");
  setpvalue(&k, cast(void *, p));
  setobj2s(L, L->top, luaH_get(hvalue(t), &k));
  api_incr_top(L);
  lua_unlock(L);
}
开发者ID:AdunSG,项目名称:Pktgen-DPDK,代码行数:11,代码来源:lapi.c


示例13: luaR_next_helper

static void luaR_next_helper(lua_State *L, const luaR_entry *pentries, int pos, TValue *key, TValue *val) {
  setnilvalue(key);
  setnilvalue(val);
  if (pentries[pos].key.type != LUA_TNIL) {
    /* Found an entry */
    if (pentries[pos].key.type == LUA_TSTRING)
      setsvalue(L, key, luaS_newro(L, pentries[pos].key.id.strkey))
    else
      setnvalue(key, (lua_Number)pentries[pos].key.id.numkey)
   setobj2s(L, val, &pentries[pos].value);
  }
}
开发者ID:Theemuts,项目名称:eLuaBrain,代码行数:12,代码来源:lrotable.c


示例14: _dumpTypeByAddress

	//----------------------------------------------------------------//
	static void _dumpTypeByAddress ( lua_State* L, TValue* tvalue, const char *name, bool verbose, TableSet& foundTables ) {

		MOAILuaState state ( L );
		
		lua_lock ( L );
		setobj2s ( L, L->top, tvalue );
		L->top++;
		lua_unlock ( L );

		_dumpType ( L, -1, name, verbose, foundTables );
		lua_pop ( L, 1 );
	}
开发者ID:flimshaw,项目名称:moai-dev,代码行数:13,代码来源:MOAILuaRuntime.cpp


示例15: lua_xmove

LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
  int i;
  if (from == to) return;
  lua_lock(to);
  api_checknelems(from, n);
  api_check(from, G(from) == G(to), "moving among independent states");
  api_check(from, to->ci->top - to->top >= n, "not enough elements to move");
  from->top -= n;
  for (i = 0; i < n; i++) {
    setobj2s(to, to->top++, from->top + i);
  }
  lua_unlock(to);
}
开发者ID:AdunSG,项目名称:Pktgen-DPDK,代码行数:13,代码来源:lapi.c


示例16: ju_const

/* local const, ok = jit.util.const(func, idx) */
static int ju_const(lua_State *L)
{
  Proto *pt = check_LCL(L)->l.p;
  int idx = luaL_checkint(L, 2);
  if (idx < 0) idx = -idx;  /* Handle both positive and negative indices. */
  if (idx >= 1 && idx <= pt->sizek) {
    setobj2s(L, L->top-1, &pt->k[idx-1]);
    lua_pushboolean(L, 1);
    return 2;
  }
  lua_pushnil(L);
  lua_pushboolean(L, 0);
  return 2;
}
开发者ID:Neoniet,项目名称:upspring,代码行数:15,代码来源:ljitlib.c


示例17: ju_upvalue

/* local upvalue, ok = jit.util.upvalue(func, idx) */
static int ju_upvalue(lua_State *L)
{
  Closure *cl = check_LCL(L);
  Proto *pt = cl->l.p;
  int idx = luaL_checkint(L, 2);
  if (idx >= 0 && idx < pt->nups) {
    setobj2s(L, L->top-1, cl->l.upvals[idx]->v);
    lua_pushboolean(L, 1);
    return 2;
  }
  lua_pushnil(L);
  lua_pushboolean(L, 0);
  return 2;
}
开发者ID:Neoniet,项目名称:upspring,代码行数:15,代码来源:ljitlib.c


示例18: lua_xmove

LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
  int i;
  if (from == to) return;
  lua_lock(to);
  api_checknelems(from, n);
  api_check(from, G(from) == G(to), "moving among independent states");
  api_check(from, to->ci->top - to->top >= n, "stack overflow");
  from->top -= n;
  for (i = 0; i < n; i++) {
    setobj2s(to, to->top, from->top + i);
    to->top++;  /* stack already checked by previous 'api_check' */
  }
  lua_unlock(to);
}
开发者ID:DSkywalk,项目名称:RetroArch,代码行数:14,代码来源:lapi.c


示例19: auxgetstr

static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
  const TValue *slot;
  TString *str = luaS_new(L, k);
  if (luaV_fastget(L, t, str, slot, luaH_getstr)) {
    setobj2s(L, L->top, slot);
    api_incr_top(L);
  }
  else {
    setsvalue2s(L, L->top, str);
    api_incr_top(L);
    luaV_finishget(L, t, L->top - 1, L->top - 1, slot);
  }
  lua_unlock(L);
  return ttnov(L->top - 1);
}
开发者ID:DSkywalk,项目名称:RetroArch,代码行数:15,代码来源:lapi.c


示例20: freeobj

static void freeobj (lua_State *L, GCObject *o) {
    global_State *g = G(L);
    lua_assert(is_robj(o));
    switch (o->gch.tt) {
    case LUA_TPROTO:
        luaF_freeproto(L, gco2p(o));
        break;
    case LUA_TFUNCTION:
        luaF_freeclosure(L, gco2cl(o));
        break;
    case LUA_TUPVAL:
        luaF_freeupval(L, gco2uv(o));
        break;
    case LUA_TTABLE:
        luaH_free(L, gco2h(o));
        break;
    case LUA_TTHREAD: {
        lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread);
        luaE_freethread(L, gco2th(o));
        break;
    }
    case LUA_TSTRING: {
        G(L)->strt.nuse--;
        luaM_freemem(L, o, sizestring(gco2ts(o)));
        break;
    }
    case LUA_TUSERDATA: {
        const Udata *udata = rawgco2u(o);
        const TValue *tm = fasttm(L, udata->uv.metatable, TM_GC);
        if (tm != NULL) {
            lu_byte oldah = L->allowhook;
            lu_mem oldt = g->GCthreshold;
            L->allowhook = 0;  /* stop debug hooks during GC tag method */
            g->GCthreshold = 2*g->totalbytes;  /* avoid GC steps */
            setobj2s(L, L->top, tm);
            setuvalue(L, L->top+1, udata);
            L->top += 2;
            luaD_call(L, L->top - 2, 0);
            L->allowhook = oldah;  /* restore hooks */
            g->GCthreshold = oldt;  /* restore threshold */
        }
        luaM_freemem(L, o, sizeudata(gco2u(o)));
        break;
    }
    default:
        lua_assert(0);
    }
}
开发者ID:hogelog,项目名称:ostacklua,代码行数:48,代码来源:lregion.c



注:本文中的setobj2s函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setobj2t函数代码示例发布时间:2022-05-30
下一篇:
C++ setobj2n函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap