Пример #1
0
void tLuaCOMEnumerator::push(lua_State* L)
{
  LUASTACK_SET(L);

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

  luaCompat_setType(L, -2);

  lua_pushstring(L, ENUMERATOR_FIELD);

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

  luaCompat_newTypedObject(L, this);

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

  LUASTACK_CLEAN(L, 1);
}
Пример #2
0
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;
}
Пример #3
0
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);
}
Пример #4
0
void LuaBeans::push(lua_State* L, void* userdata )
{
  LUASTACK_SET(L);

  lua_newtable(L);

  lua_pushstring(L, "_USERDATA_REF_");

  luaCompat_pushTypeByName(L, module_name, udtag_name);
  luaCompat_newTypedObject(L, userdata);

  lua_settable(L, -3);

  luaCompat_pushTypeByName(L, module_name, tag_name);
  luaCompat_setType(L, -2);

  LUASTACK_CLEAN(L, 1);
}
Пример #5
0
void LuaBeans::push( void* userdata )
{
  LUASTACK_SET(L);

  lua_newtable(L);

  lua_pushstring(L, "_USERDATA_REF_");

  luaCompat_pushTypeByName(L, module_name, udtag_name);
  luaCompat_newTypedObject(L, userdata);

  lua_settable(L, -3);

  if (this->mlist)
    register_methods(L, -1, this->mlist->table, this->mlist->n);

  luaCompat_pushTypeByName(L, module_name, tag_name);
  luaCompat_setType(L, -2);

  LUASTACK_CLEAN(L, 1);
}
Пример #6
0
LuaBeans* LuaBeans::createBeans(lua_State *L,
                                const char* module_name,
                                const char* name)
{
  LUASTACK_SET(L);

  luaCompat_moduleGet(L, module_name, "LuaBeansTable");

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

    lua_newtable(L);

    lua_pushvalue(L, -1);

    luaCompat_moduleSet(L, module_name, "LuaBeansTable");
  }
 
  lua_pushstring(L, (char*)name);

  LuaBeans* lbeans = new LuaBeans(L, module_name, name);
  luaCompat_pushTypeByName(L, module_name, "LuaBeansObject");

  // sets GC callback
  lua_pushcfunction(L, LuaBeans::gc);
  luaCompat_handleGCEvent(L);

  luaCompat_newTypedObject(L, lbeans);

  lua_settable(L, -3);

  lua_pop(L, 1);

  LUASTACK_CLEAN(L, 0);

  return lbeans;
}