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

C++ LUASTACK_CLEAN函数代码示例

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

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



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

示例1: LUASTACK_SET

bool tLuaObject::pushCachedObject(lua_State *L, void *pointer)
{
  LUASTACK_SET(L);

#ifdef LUA5
  luaCompat_moduleGet(L, MODULENAME, INSTANCES_CACHE);

  lua_pushlightuserdata(L, pointer);
  lua_gettable(L, -2);

  lua_remove(L, -2);

  if(lua_isnil(L, -1))
  {
    lua_pop(L, 1);

    LUASTACK_CLEAN(L, 0);
    return false;
  }

  LUASTACK_CLEAN(L, 1);

  return true;
#else
  return false;
#endif
}
开发者ID:Rocket-Buddha,项目名称:GameCode4,代码行数:27,代码来源:tLuaObject.cpp


示例2: luaCompat_openlib

void luaCompat_openlib(lua_State* L, const char* libname, const struct luaL_reg* funcs)
{ /* lua4 */
  LUASTACK_SET(L);

  char funcname[1000];

  lua_newtable(L);  /* create it */
  lua_pushvalue(L, -1);
  lua_setglobal(L, libname);  /* register it with given name */

  for (; funcs->name; funcs++)
  {
    int i;
    lua_pushstring(L, funcs->name);
    lua_pushcfunction(L, funcs->func);
    lua_settable(L, -3);

    funcname[0] = '\0';

    strncat(funcname, libname, 1000);
    strcat(funcname, "_");
    strncat(funcname, funcs->name, 1000 - strlen(libname) - strlen(funcs->name) - 2);
    lua_pushcfunction(L, funcs->func);
    lua_setglobal(L, funcname);
  }

  LUASTACK_CLEAN(L, 1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:28,代码来源:LuaCompat.c


示例3: LUASTACK_SET

void tLuaCOMEnumerator::registerLuaType(lua_State *L, const char *module)
{
  LUASTACK_SET(L);

  tLuaCOMEnumerator::module_name = module;

  luaCompat_newLuaType(L, 
    tLuaCOMEnumerator::module_name, 
    tLuaCOMEnumerator::type_name);

  luaCompat_newLuaType(L, 
    tLuaCOMEnumerator::module_name, 
    tLuaCOMEnumerator::pointer_type_name);

  luaCompat_pushTypeByName(L, 
    tLuaCOMEnumerator::module_name, 
    tLuaCOMEnumerator::type_name);

  lua_pushcfunction(L, tLuaCOMEnumerator::index);
  luaCompat_handleNoIndexEvent(L);

  lua_pop(L, 1);

  luaCompat_pushTypeByName(L, 
    tLuaCOMEnumerator::module_name, 
    tLuaCOMEnumerator::pointer_type_name);

  lua_pushcfunction(L, tLuaCOMEnumerator::garbagecollect);
  luaCompat_handleGCEvent(L);

  lua_pop(L, 1);
  
  LUASTACK_CLEAN(L, 0);
}
开发者ID:Rocket-Buddha,项目名称:GameCode4,代码行数:34,代码来源:tLuaCOMEnumerator.cpp


示例4: LUASTACK_SET

int tLuaObject::generic_PushNew(lua_State* L,
                                tLuaObject* lua_obj,
                                const char* type_name,
                                const char* pointer_type_name
                                )
{
  LUASTACK_SET(L);

  // creates table
  lua_newtable(L);
  luaCompat_pushTypeByName(L, MODULENAME, type_name);

  lua_setmetatable(L, -2);

  lua_pushstring(L, TLUAOBJECT_POINTER_FIELD);

  // pushes typed pointer
  luaCompat_pushTypeByName(L, MODULENAME, pointer_type_name);

  luaCompat_newTypedObject(L, lua_obj);

  // stores in the table
  lua_settable(L, -3);

  LUASTACK_CLEAN(L, 1);

  return 1;
}
开发者ID:1linux,项目名称:luacom,代码行数:28,代码来源:tLuaObject.cpp


示例5: LUASTACK_SET

void tLuaCOMEnumerator::push(lua_State* L)
{
  LUASTACK_SET(L);

  tStringBuffer module_name(tUtil::RegistryGetString(L, module_name_key));
  LUASTACK_DOCLEAN(L, 0);

  // creates table
  lua_newtable(L);
  luaCompat_pushTypeByName(L, 
    module_name, 
    tLuaCOMEnumerator::type_name);

  lua_setmetatable(L, -2);

  lua_pushstring(L, ENUMERATOR_FIELD);

  // pushes typed pointer
  luaCompat_pushTypeByName(L, 
    module_name, 
    tLuaCOMEnumerator::pointer_type_name);

  luaCompat_newTypedObject(L, this);

  // stores in the table
  lua_settable(L, -3);

  LUASTACK_CLEAN(L, 1);
}
开发者ID:1linux,项目名称:luacom,代码行数:29,代码来源:tLuaCOMEnumerator.cpp


示例6: luaCompat_newTypedObject

int luaCompat_newTypedObject(lua_State* L, void* object)
{  /* lua4 */
  int newreference = 0;
  int tag = 0;

  LUASTACK_SET(L);

  luaL_checktype(L, -1, LUA_TNUMBER);

  tag = (int) lua_tonumber(L, -1);

  lua_pop(L, 1);

  /* pushes userdata */
  lua_pushusertag(L, object, LUA_ANYTAG);

  if(lua_tag(L, -1) != tag)
  {
    /* this is the first userdata with this value,
       so corrects the tag */
    lua_settag(L, tag);
    newreference = 1;
  }

  LUASTACK_CLEAN(L, 0);

  return newreference;
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:28,代码来源:LuaCompat.c


示例7: LUASTACK_SET

void LuaBeans::registerPointerEvents(lua_State* L, class Events& events)
{
  LUASTACK_SET(L);

  luaCompat_pushTypeByName(L, module_name, udtag_name);

  if(events.gettable)
  {
    lua_pushcfunction(L, events.gettable);
    luaCompat_handleGettableEvent(L);
  }

  if(events.settable)
  {
    lua_pushcfunction(L, events.settable);
    luaCompat_handleSettableEvent(L);
  }

  if(events.noindex)
  {
    lua_pushcfunction(L, events.noindex);
    luaCompat_handleNoIndexEvent(L);
  }

  if(events.gc)
  {
    lua_pushcfunction(L, events.gc);
    luaCompat_handleGCEvent(L);
  }

  lua_pop(L, 1);

  LUASTACK_CLEAN(L, 0);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:34,代码来源:luabeans.cpp


示例8: luaCompat_pushCBool

void luaCompat_pushCBool(lua_State* L, int value)
{ /* lua5 */
  LUASTACK_SET(L);

  lua_pushboolean(L, value);

  LUASTACK_CLEAN(L, 1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:8,代码来源:LuaCompat.c


示例9: luaopen_luawinapi_core

LUAWINAPI_API int luaopen_luawinapi_core(lua_State *L)
{
  LUASTACK_SET(L);

  // init stdcallthunk module
  stdcallthunk_initialize();
  atexit(stdcallthunk_finalize);

  // luacwrap = require("luacwrap")
  lua_getglobal(L, "require");
  lua_pushstring(L, "luacwrap");
  lua_call(L, 1, 1);
  // lua_setfield(L, LUA_ENVIRONINDEX, "luacwrap");

  // get c interface
  lua_getfield(L, -1, LUACWARP_CINTERFACE_NAME);
  g_luacwrapiface = (luacwrap_cinterface*)lua_touserdata(L, -1);
  
  // check for C interface
  if (NULL == g_luacwrapiface)
  {
    luaL_error(L, "Could not load luacwrap: No C interface available.");
  }

  // check interface version
  if (LUACWARP_CINTERFACE_VERSION != g_luacwrapiface->version)
  {
    luaL_error(L, "Could not load luacwrap: Incompatiple C interface version. Expected %i got %i.", LUACWARP_CINTERFACE_VERSION, g_luacwrapiface->version);
  }
  
  // drop C interface and drop package table
  lua_pop(L, 2);

  // create module table
  lua_newtable(L);

  // set info fields
  lua_pushstring(L, "Klaus Oberhofer");
  lua_setfield(L, -2, "_AUTHOR");

  lua_pushstring(L, "1.3.0-1");
  lua_setfield(L, -2, "_VERSION");

  lua_pushstring(L, "MIT license: See LICENSE for details.");
  lua_setfield(L, -2, "_LICENSE");

  lua_pushstring(L, "https://github.com/oberhofer/luawinapi");
  lua_setfield(L, -2, "_URL");
  
  // register package functionality
  register_luawinapi(L);

  register_EnumChildWindows(L);

  LUASTACK_CLEAN(L, 1);
  return 1;
}
开发者ID:LuaDist2,项目名称:luawinapi,代码行数:57,代码来源:luawinapi.c


示例10: luaCompat_handleEqEvent

void luaCompat_handleEqEvent(lua_State* L)
{ /* lua4 */
  LUASTACK_SET(L);

  /* lua4 does not have eq event */
  lua_pop(L, 1);

  LUASTACK_CLEAN(L, -1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:9,代码来源:LuaCompat.c


示例11: luaCompat_getType

void luaCompat_getType(lua_State* L, int index)
{ /* lua4 */
  LUASTACK_SET(L);

  int tag = lua_tag(L, index);
  lua_pushnumber(L, tag);

  LUASTACK_CLEAN(L, 1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:9,代码来源:LuaCompat.c


示例12: luaCompat_setType

void luaCompat_setType(lua_State* L, int index)
{ /* lua5 */

  LUASTACK_SET(L);

  lua_setmetatable(L, index);    

  LUASTACK_CLEAN(L,-1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:9,代码来源:LuaCompat.c


示例13: luaCompat_handleFuncCallEvent

void luaCompat_handleFuncCallEvent(lua_State* L)
{ /* lua4 */
  LUASTACK_SET(L);

  int tag = lua_tonumber(L, -2);

  lua_settagmethod(L, tag, "function");

  LUASTACK_CLEAN(L, -1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:10,代码来源:LuaCompat.c


示例14: luaCompat_handleNoIndexEvent

void luaCompat_handleNoIndexEvent(lua_State* L)
{ /* lua4 */
  LUASTACK_SET(L);

  int tag = lua_tonumber(L, -2);

  lua_settagmethod(L, tag, "index");

  LUASTACK_CLEAN(L, -1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:10,代码来源:LuaCompat.c


示例15: luaCompat_moduleGet

void luaCompat_moduleGet(lua_State* L, const char* module, const char* key)
{
  LUASTACK_SET(L);

  lua_getfield(L, LUA_REGISTRYINDEX, module);
  lua_getfield(L, -1, key);
  lua_remove(L, -2);

  LUASTACK_CLEAN(L, 1);
}
开发者ID:brkpt,项目名称:luaplus51-all,代码行数:10,代码来源:LuaCompat.cpp


示例16: luaCompat_moduleSet

void luaCompat_moduleSet(lua_State* L, const char* module, const char* key)
{
  LUASTACK_SET(L);

  lua_getfield(L, LUA_REGISTRYINDEX, module);
  lua_pushvalue(L, -2);
  lua_setfield(L, -2, key);
  lua_pop(L, 2);

  LUASTACK_CLEAN(L, -1);
}
开发者ID:brkpt,项目名称:luaplus51-all,代码行数:11,代码来源:LuaCompat.cpp


示例17: winapi_GetClassNameW

int winapi_GetClassNameW(lua_State* L)
{
  HWND hwnd;
  size_t size;
  char buffer[2048];
  LUASTACK_SET(L);

  hwnd = lua_toWindow(L, 1);

  size = GetClassNameW(hwnd, (LPWSTR)&buffer, sizeof(buffer)/sizeof(WCHAR));
  if (size)
  {
    lua_pushlstring(L, buffer, size*sizeof(WCHAR));

    LUASTACK_CLEAN(L, 1);
    return 1;
  }

  LUASTACK_CLEAN(L, 0);
  return 0;
}
开发者ID:LuaDist2,项目名称:luawinapi,代码行数:21,代码来源:enumwindow.c


示例18: luaCompat_handleSettableEvent

void luaCompat_handleSettableEvent(lua_State* L)
{ /* lua5 */
  LUASTACK_SET(L);

  lua_pushstring(L, "__newindex");
  lua_insert(L, -2);

  lua_settable(L, -3);

  LUASTACK_CLEAN(L, -1);

}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:12,代码来源:LuaCompat.c


示例19: luaCompat_moduleGet

void luaCompat_moduleGet(lua_State* L, const char* module, const char* key)
{ /* lua4 */
  LUASTACK_SET(L);

  lua_getglobal(L, module);
  lua_pushstring(L, key);

  lua_gettable(L, -2);

  lua_remove(L, -2);

  LUASTACK_CLEAN(L, 1);
}
开发者ID:WeyrSDev,项目名称:gamecode3,代码行数:13,代码来源:LuaCompat.c


示例20: register_EnumChildWindows

int register_EnumChildWindows(lua_State* L)
{
  LUASTACK_SET(L);

  // create method table
#if (LUA_VERSION_NUM > 501)
  luaL_setfuncs(L, methods, 0);
#else
  luaL_openlib(L, NULL, methods, 0);
#endif

  LUASTACK_CLEAN(L, 0);
  return 0;
}
开发者ID:LuaDist2,项目名称:luawinapi,代码行数:14,代码来源:enumwindow.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ LUASTACK_SET函数代码示例发布时间:2022-05-30
下一篇:
C++ LUACHECKOBJ函数代码示例发布时间: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