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