Types In use with Module Functions
BlitzMax Forums/BlitzMax Programming/Types In use with Module Functions
| ||
I'm trying to create a module for text effects that uses an object for each letter. The text effects are all part of a module, and the letter's methods use functions from the rest of the module, so they have to be in the same file. :(Nasty Loop) Unfortunately, the compiler won't seem to let me create a object from a module function (Unable to convert from '<unknown>' to 'Letter' in the line 'local l:Letter = new letter'. Does anyone have any advice on the situation? Thanks, KrayzBlu |
| ||
You'll need to post some code. |
| ||
Thats very bad OO design. If the functions are used on letters only, then they should be part of the letter class and not an external thing. Thats exactly against what classes are actually for: Encapsulating code into its objects. |
| ||
Thats very bad OO design. If the functions are used on letters only, then they should be part of the letter class and not an external thing. Yeah, unfortunately, the function that my methods use are common functions that are used in many other places outside the class. You'll need to post some code. Well, to make a long story short.... type letter field stuff method draw() stuff = a() end method end type function a() 'Do stuff end function function b() local l:letter = new letter '<----- Compiler stops here l.stuff = 2 end function |
| ||
Yeah, unfortunately, the function that my methods use are common functions that are used in many other places outside the class. In which case they should be part of a super class that your letters extend. |
| ||
Hmm this error does not make much sense ... At least as long you have nothing else called letter that might interfere ... did you try renaming the class to something different like TLETTER and check that? |
| ||
try renaming the class to something different Of all things... :/ Thanks for your help everyone, KrayzBlu |