Created
September 27, 2009 16:41
-
-
Save slaskis/194875 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function call( scope , func ) { | |
var obj = Type.createEmptyInstance( Home ); | |
//var obj = Type.createInstance( Home , [] ); | |
trace( Type.getInstanceFields( obj ) ); | |
if( !Reflect.hasField( obj , func ) ) | |
throw obj + " does not contain " + func; | |
var method = Reflect.field( obj , func ); | |
if( !Reflect.isFunction( method ) ) | |
throw func + " is not a method of " + obj; | |
var ret = Reflect.callMethod( obj , method , [] ); | |
trace( "Returned: " + ret ); | |
return ret; | |
} | |
call( Home , "index" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Home extends Controller { | |
public function index() { | |
return "view/Home.ehx"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment