Alias not working
Monkey Forums/Monkey Programming/Alias not working
| ||
Just started using Monkey today, and I am trying to learn all the new stuff (new when you're coming from BLitzMax). I have encountered a problem. For some reason the Alias keyword isn't working. All I get is either "Syntax error - expecting declaration." or "Syntax error - unexpected token 'alias'" depending on whether I put it in a function or in the root of the translation unit. Any thoughts? |
| ||
The example I am trying out is: [monkeycode] Strict Class Test End Alias NewName = Test Function Main:Int() local instance:NewName = new NewName Return 0 End [/monkeycode] |
| ||
Aliases have to be declared after your Import statements and before any other code, and they also must reference identifiers in other modules, not the current file. Like-a so: [monkeycode] Import mojo Alias mojoImage = mojo.Image Class TestClass End ... [/monkeycode] |
| ||
Ahh, okay. I see. :) Thank you for that clarification! |