//----------------------------------------------------------------//
int MOAILuaObject::_tostring ( lua_State* L ) {

	MOAILuaState state ( L );

	MOAILuaObject* data = ( MOAILuaObject* )state.GetPtrUserData ( 1 );
	if ( data ) {
		
		STLString str;
		
		lua_getfield ( state, 1, "getClassName" );
		if ( state.IsType ( -1, LUA_TFUNCTION )) {
		
			lua_pushvalue ( state, 1 );
			state.DebugCall ( 1, 1 );
			cc8* classname = state.GetValue < cc8* >( -1, "" );
			str.write ( "%p <%s>", data, classname );
			state.Push ( str );
			return 1;
		}
		
		str.write ( "%p <%s>", data, data->TypeName ());
		state.Push ( str );
		return 1;
	}
	return 0;
}
Exemple #2
0
/**	@name	getMaxTextureUnits
	@text	Returns the frame buffer associated with the device.

	@out	MOAIFrameBuffer frameBuffer
*/
int MOAIGfxDevice::_getFrameBuffer ( lua_State* L ) {

	MOAILuaState state ( L );
	state.Push ( MOAIGfxDevice::Get ().GetDefaultBuffer ());

	return 1;
}
Exemple #3
0
//----------------------------------------------------------------//
// TODO: doxygen
int MOAIVertexFormatMgr::_getFormat ( lua_State* L ) {
	MOAILuaState state ( L );

	u32 formatID = state.GetValue < u32 >( 1, 0xffffffff );
	
	state.Push ( MOAIVertexFormatMgr::Get ().GetFormat ( formatID ));
	return 1;
}
//----------------------------------------------------------------//
int MOAILuaObject::_tostring ( lua_State* L ) {

	MOAILuaState state ( L );

	MOAILuaObject* data = ( MOAILuaObject* )state.GetPtrUserData ( 1 );
	if ( data ) {
	
		STLString str;
		str.write ( "0x%p <%s>", data, data->TypeName ()); // TODO: 64-bit
		state.Push ( str );
		return 1;
	}
	return 0;
}
Exemple #5
0
	//----------------------------------------------------------------//
	// TODO: doxygen
	int MOAIMath::_randSFMT ( lua_State* L ) {
		MOAILuaState state ( L );
		
		double lower = 0.0;
		double upper = 1.0;
		
		if ( state.IsType ( 1, LUA_TNUMBER )) {
		
			upper = state.GetValue < double >( 1, 0.0 );
		
			if ( state.IsType ( 2, LUA_TNUMBER )) {
				lower = upper;
				upper = state.GetValue < double >( 2, 0.0 );
			}
		}
		
		double r = sfmt_genrand_real1 ( MOAIMath::Get ().mSFMT ); // [0, 1]
		state.Push ( lower + ( r * ( upper - lower )));
		return 1;
	}
//----------------------------------------------------------------//
void MOAILuaClass::PushInterfaceTable ( MOAILuaState& state ) {

	state.Push ( this->mInterfaceTable );
}
Exemple #7
0
bool MOAITBWidget::PushTBWidgetOrNil( MOAILuaState& state, TBWidget* widget ) {
	if( PushTBWidget( state, widget ) ) return true;
	state.Push();
	return false;
}