types and making modules

BlitzMax Forums/BlitzMax Beginners Area/types and making modules

Bremer(Posted 2005) [#1]
When making a module out of some blitzmax code, is it then possible to keep types private? I am getting some errors when I try . Here is some code showing what I am trying to do:

Private

Global zsResourceList:TList = CreateList()
Global zsr:zsResource
Type zsResource
	Field resource:Int
	Hield width:Int
	Hield height:Int

Function Load:zsResource( url:Object )
	Local temp:TPixmap = LoadPixmap( url )
	zsr.zsResource = New zsResource
	zsr.width = temp.width
	zsr.height = temp.height
	zsr.resource = GLTexFromPixmap( temp )
	temp = Null
	zsResourceList.AddLast( zsr )
	Return zsr
End Function

End Type

Public
Function zsLoadResource( url:Object )
	Return zsResource.Load( url )
End Function


I would like to have the functions of the type, and the type itself private, and still have the public function working.

But I am getting the following error on the public function:

Compile Error
Identifier 'zsResource' not found

So apparently the above isn't the way to go about this. Any suggestions and advise is very welcome so that I can finish my module.


Dreamora(Posted 2005) [#2]
You can't.

The only way you can do it is described in the "information hiding" thread in the FAQ board.


Bremer(Posted 2005) [#3]
[edit] I found the thread and will take a look, thanks.