本文整理汇总了C++中MOAILuaState::HexDecode方法的典型用法代码示例。如果您正苦于以下问题:C++ MOAILuaState::HexDecode方法的具体用法?C++ MOAILuaState::HexDecode怎么用?C++ MOAILuaState::HexDecode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MOAILuaState
的用法示例。
在下文中一共展示了MOAILuaState::HexDecode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _hexDecode
/** @name hexDecode
@text If a string is provided, decodes it as a hex encoded string. Otherwise, decodes the current data stored in this object as a hex encoded sequence of bytes.
@opt MOAIDataBuffer self
@opt string data The string data to decode. You must either provide either a MOAIDataBuffer (via a :hexDecode type call) or string data (via a .hexDecode type call), but not both.
@out string output If passed a string, returns either a string or nil depending on whether it could be decoded. Otherwise the decoding occurs inline on the existing data buffer in this object, and nil is returned.
*/
int MOAIDataBuffer::_hexDecode ( lua_State* L ) {
MOAILuaState state ( L );
if ( state.IsType ( 1, LUA_TSTRING )) {
return state.HexDecode ( 1 ) ? 1 : 0;
}
MOAIDataBuffer* self = state.GetLuaObject < MOAIDataBuffer >( 1, true );
if ( self ) {
if ( state.IsType ( 2, LUA_TSTRING )) {
size_t len;
cc8* str = lua_tolstring ( state, 2, &len );
self->Load (( void* )str, len );
}
self->HexDecode ();
}
return 0;
}