当前位置: 首页>>代码示例>>C++>>正文


C++ setobj2s函数代码示例

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


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


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