本文整理汇总了C++中luabind::object::type方法的典型用法代码示例。如果您正苦于以下问题:C++ object::type方法的具体用法?C++ object::type怎么用?C++ object::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类luabind::object
的用法示例。
在下文中一共展示了object::type方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void parse_table (luabind::object const &table, LPCSTR identifier, luabind::object &result)
{
VERIFY2 (table.type() == LUA_TTABLE, "invalid loophole description passed");
result = table[identifier];
VERIFY2 (result.type() != LUA_TNIL, make_string("cannot read table value %s", identifier));
VERIFY2 (result.type() == LUA_TTABLE, make_string("cannot read table value %s", identifier));
}
示例2: xr_string
xr_string to_string (luabind::object const& o)
{
using namespace luabind;
if (o.type() == LUA_TSTRING) return object_cast<xr_string>(o);
lua_State* L = o.lua_state();
LUABIND_CHECK_STACK(L);
#ifdef BOOST_NO_STRINGSTREAM
std::strstream s;
#else
std::stringstream s;
#endif
if (o.type() == LUA_TNUMBER)
{
s << object_cast<float>(o);
return xr_string(s.str().c_str());
}
s << "<" << lua_typename(L, o.type()) << ">";
#ifdef BOOST_NO_STRINGSTREAM
s << std::ends;
#endif
return s.str().c_str();
}
示例3:
void smart_cover::action::add_animation(LPCSTR type, luabind::object const &table)
{
VERIFY ( table.type() == LUA_TTABLE );
luabind::object::iterator I = table.begin();
luabind::object::iterator E = table.end();
Animations* animations = xr_new<Animations>( );
for ( ; I != E; ++I) {
luabind::object string = *I;
if (string.type() != LUA_TSTRING) {
VERIFY ( string.type() != LUA_TNIL );
continue;
}
shared_str animation = luabind::object_cast<LPCSTR>(string);
VERIFY2 (
std::find(
animations->begin(),
animations->end(),
animation
) ==
animations->end(),
make_string(
"duplicated_animation found: %s",
animation.c_str()
)
);
animations->push_back ( animation );
}
m_animations.insert ( std::make_pair( type, animations ) );
}
示例4: parse_fvector
Fvector parse_fvector (luabind::object const &table, LPCSTR identifier)
{
VERIFY2 (table.type() == LUA_TTABLE, "invalid loophole description passed");
luabind::object result = table[identifier];
VERIFY2 (result.type() != LUA_TNIL, make_string("cannot read vector value %s", identifier));
return (luabind::object_cast<Fvector>(result));
}
示例5: p
xr_string member_to_string (luabind::object const& e, LPCSTR function_signature)
{
#if !defined(LUABIND_NO_ERROR_CHECKING3)
using namespace luabind;
lua_State* L = e.lua_state();
LUABIND_CHECK_STACK(L);
if (e.type() == LUA_TFUNCTION)
{
e.pushvalue();
detail::stack_pop p(L, 1);
{
if (lua_getupvalue(L, -1, 3) == 0) return to_string(e);
detail::stack_pop p2(L, 1);
if (lua_touserdata(L, -1) != reinterpret_cast<void*>(0x1337)) return to_string(e);
}
#ifdef BOOST_NO_STRINGSTREAM
std::strstream s;
#else
std::stringstream s;
#endif
{
lua_getupvalue(L, -1, 2);
detail::stack_pop p2(L, 1);
}
{
lua_getupvalue(L, -1, 1);
detail::stack_pop p2(L, 1);
detail::method_rep* m = static_cast<detail::method_rep*>(lua_touserdata(L, -1));
for (std::vector<detail::overload_rep>::const_iterator i = m->overloads().begin();
i != m->overloads().end(); ++i)
{
xr_string str;
i->get_signature(L, str);
if (i != m->overloads().begin())
s << "\n";
s << function_signature << process_signature(str) << ";";
}
}
#ifdef BOOST_NO_STRINGSTREAM
s << std::ends;
#endif
return s.str().c_str();
}
return to_string(e);
#else
return "";
#endif
}
示例6: setGeometryIndices
void setGeometryIndices( Geometry * pGeom, const luabind::object & indexTable )
{
if ( indexTable.is_valid() && indexTable.type() == LUA_TTABLE )
{
if ( !pGeom->m_indexBuffer ) pGeom->m_indexBuffer.reset( new vector<unsigned short> );
unsigned int uiNewIndices = 0;
pGeom->m_indexBuffer->clear();
for( luabind::object::array_iterator iter = indexTable.abegin();
iter != indexTable.aend();
iter++, uiNewIndices++ )
{
boost::optional<unsigned short> oindex = luabind::object_cast_nothrow<unsigned short>( *iter );
if ( oindex )
pGeom->m_indexBuffer->push_back( *oindex.get() );
}
pGeom->m_indexCount = uiNewIndices;
}
}
示例7: setGeometryTexture1
void setGeometryTexture1( Geometry * pGeom, const luabind::object & texture1Table )
{
if ( texture1Table.is_valid() && texture1Table.type() == LUA_TTABLE )
{
if ( !pGeom->m_texture1Buffer ) pGeom->m_texture1Buffer.reset( new vector<float> );
pGeom->m_texture1Buffer->clear();
for( luabind::object::array_iterator iter = texture1Table.abegin();
iter != texture1Table.aend();
iter++ )
{
boost::optional<Point2> opt = luabind::object_cast_nothrow<Point2>( *iter );
if ( opt )
{
Point2 * pt = opt.get();
pGeom->m_texture1Buffer->push_back( pt->x );
pGeom->m_texture1Buffer->push_back( pt->y );
}
}
}
}
示例8: setGeometryColor
void setGeometryColor( Geometry * pGeom, const luabind::object & colorTable )
{
if ( colorTable.is_valid() && colorTable.type() == LUA_TTABLE )
{
if ( !pGeom->m_colorBuffer ) pGeom->m_colorBuffer.reset( new vector<float> );
pGeom->m_colorBuffer->clear();
for( luabind::object::array_iterator iter = colorTable.abegin();
iter != colorTable.aend();
iter++ )
{
boost::optional<ColorA> opt = luabind::object_cast_nothrow<ColorA>( *iter );
if ( opt )
{
ColorA * pt = opt.get();
pGeom->m_colorBuffer->push_back( pt->r );
pGeom->m_colorBuffer->push_back( pt->g );
pGeom->m_colorBuffer->push_back( pt->b );
pGeom->m_colorBuffer->push_back( pt->a );
}
}
}
}
示例9: setGeometryVertices
//
// Local Functions
//
void setGeometryVertices( Geometry * pGeom, const luabind::object & vertexTable )
{
if ( vertexTable.is_valid() && vertexTable.type() == LUA_TTABLE )
{
if ( !pGeom->m_vertexBuffer ) pGeom->m_vertexBuffer.reset( new vector<float> );
pGeom->m_vertexBuffer->clear();
unsigned uiNewVertices = 0;
for( luabind::object::array_iterator iter = vertexTable.abegin();
iter != vertexTable.aend();
iter++, uiNewVertices++ )
{
boost::optional<Point3> opt = luabind::object_cast_nothrow<Point3>( *iter );
if ( opt )
{
Point3 * pt = opt.get();
pGeom->m_vertexBuffer->push_back( pt->x );
pGeom->m_vertexBuffer->push_back( pt->y );
pGeom->m_vertexBuffer->push_back( pt->z );
}
}
pGeom->m_vertexCount = uiNewVertices;
}
}