Set function return type in Haxe -


for reason, error message whenever try compile simple function: test.hx:1: lines 1-7 : invalid -main : test has invalid main function

public static function main(a:int, b:int){     trace("calling main function");     return a+b; } 

i'm not sure why happening. what's wrong function definition, , how can compile correctly? tried reading the documentation, , found unclear in explanation of how set function return types.

the special main entry function must void->void function. i.e. no param , no return value allowed. remember there no command line argument concept in js/flash, haxe compiles to. have use system targets' api that:

  • sys.args() : array<string> command line params.
  • sys.exit( code : int ) : void exit exit code.

fyi, doc of sys @ http://haxe.org/api/sys


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -