META_FUNCTION( dataFragments_t, Delete )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	delete GET_META( 1, dataFragments_t );

	return 0;
}
Ejemplo n.º 2
0
META_FUNCTION( sn3_bf_write, FinishWriting )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );

	delete GET_META( 1, sn3_bf_write );

	return 0;
}
META_FUNCTION( dataFragments_t, GetCompressed )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	Lua()->Push( fragments->compressed );

	return 1;
}
META_FUNCTION( dataFragments_t, SetFileHandle )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	CopyUserDataOrNull( 2, FileHandle_t, fragments->hfile, FileHandle_t );

	return 0;
}
META_FUNCTION( dataFragments_t, GetBuffer )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	PUSH_META( fragments->buffer, UCHARPTR );

	return 1;
}
Ejemplo n.º 6
0
META_FUNCTION( UCHARPTR, Delete )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( UCHARPTR ) );

	unsigned char *ptr = (unsigned char *)GET_META( 1, UCHARPTR );

	delete[] ptr;

	return 0;
}
META_FUNCTION( dataFragments_t, GetFileName )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	Lua()->Push( (const char *)fragments->filename );

	return 1;
}
META_FUNCTION( dataFragments_t, SetBuffer )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );
	
	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	CopyUserDataOrNull( 2, UCHARPTR, fragments->buffer, unsigned char * );
		
	return 0;
}
Ejemplo n.º 9
0
META_FUNCTION( sn3_bf_write, GetBasePointer )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	PUSH_META( buf->GetBasePointer(), UCHARPTR );

	return 1;
}
META_FUNCTION( dataFragments_t, GetActualSize )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	Lua()->PushLong( fragments->actualsize );

	return 1;
}
Ejemplo n.º 11
0
META_FUNCTION( sn3_bf_write, IsOverflowed )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	Lua()->Push( buf->IsOverflowed() );

	return 1;
}
META_FUNCTION( dataFragments_t, GetNum )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	Lua()->PushLong( fragments->num );

	return 1;
}
Ejemplo n.º 13
0
META_FUNCTION( sn3_bf_write, GetNumBytesLeft )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	Lua()->PushLong( buf->GetNumBytesLeft() );

	return 1;
}
META_FUNCTION( dataFragments_t, GetFileHandle )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	PUSH_META( fragments->hfile, FileHandle_t );

	return 1;
}
META_FUNCTION( dataFragments_t, GetFileTransferID )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	Lua()->PushLong( fragments->transferid );

	return 1;
}
META_FUNCTION( INetworkStringTableContainer, FindTable )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( INetworkStringTableContainer ) );
	Lua()->CheckType( 2, GLua::TYPE_STRING );

	INetworkStringTableContainer *pContainer = GET_META( 1, INetworkStringTableContainer );

	PUSH_META( pContainer->FindTable( Lua()->GetString( 2 ) ), INetworkStringTable );

	return 1;
}
META_FUNCTION( dataFragments_t, SetActualSize )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	fragments->actualsize = Lua()->GetInteger( 2 );

	return 0;
}
Ejemplo n.º 18
0
META_FUNCTION( sn3_bf_write, WriteString )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );
	Lua()->CheckType( 2, GLua::TYPE_STRING );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	buf->WriteString( Lua()->GetString( 2 ) );

	return 0;
}
Ejemplo n.º 19
0
META_FUNCTION( sn3_bf_write, WriteShort )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	buf->WriteShort( Lua()->GetInteger( 2 ) & 0xFFFF );

	return 0;
}
Ejemplo n.º 20
0
META_FUNCTION( sn3_bf_write, WriteFloat )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	buf->WriteFloat( Lua()->GetNumber( 2 ) );

	return 0;
}
Ejemplo n.º 21
0
META_FUNCTION( sn3_bf_write, WriteBitVec3Coord )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );
	Lua()->CheckType( 2, GLua::TYPE_VECTOR );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	buf->WriteBitVec3Coord( *GET_META( 2, Vector ) );

	return 0;
}
META_FUNCTION( dataFragments_t, SetFileTransferID )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	fragments->transferid = Lua()->GetInteger( 2 );

	return 0;
}
META_FUNCTION( dataFragments_t, SetFileName )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );
	Lua()->CheckType( 2 , GLua::TYPE_STRING );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	strcpy_s( fragments->filename, MAX_PATH, Lua()->GetString( 2 ) );

	return 0;
}
META_FUNCTION( dataFragments_t, SetStream )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );
	Lua()->CheckType( 2 , GLua::TYPE_BOOL );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	fragments->stream = Lua()->GetBool( 2 );

	return 0;
}
META_FUNCTION( dataFragments_t, SetProgress )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( dataFragments_t ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );

	dataFragments_t *fragments = GET_META( 1, dataFragments_t );

	fragments->progress = Lua()->GetInteger( 2 );

	return 0;
}
Ejemplo n.º 26
0
META_FUNCTION( sn3_bf_write, Seek )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	buf->SeekToBit( Lua()->GetInteger( 2 ) );

	return 0;
}
Ejemplo n.º 27
0
META_FUNCTION( sn3_bf_write, WriteBytes )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );
	Lua()->CheckType( 2, GET_META_ID( UCHARPTR ) );
	Lua()->CheckType( 3, GLua::TYPE_NUMBER );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	Lua()->Push( buf->WriteBytes( GET_META( 2, UCHARPTR ), Lua()->GetInteger( 3 ) ) );

	return 1;
}
Ejemplo n.º 28
0
META_FUNCTION( sn3_bf_write, WriteUBitLong )
{
	UsesLua();

	Lua()->CheckType( 1, GET_META_ID( sn3_bf_write ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );
	Lua()->CheckType( 3, GLua::TYPE_NUMBER );

	sn3_bf_write *buf = GET_META( 1, sn3_bf_write );

	buf->WriteUBitLong( Lua()->GetInteger( 2 ), Lua()->GetInteger( 3 ) );

	return 0;
}
META_FUNCTION( INetworkStringTableContainer, GetTable )
{
	UsesLua();

	//Lua()->SetGlobal( "META_ID" ,  (double)GET_META_ID( INetworkStringTableContainer ) );

	Lua()->CheckType( 1, GET_META_ID( INetworkStringTableContainer ) );
	Lua()->CheckType( 2, GLua::TYPE_NUMBER );

	INetworkStringTableContainer *pContainer = GET_META( 1, INetworkStringTableContainer );

	PUSH_META( pContainer->GetTable( Lua()->GetInteger( 2 ) ), INetworkStringTable );

	return 1;
}