Share your advanced knowledge/code with the community.
-
cederavic
- Posts: 30
- Joined: Tue Feb 25, 2014 6:49 am
Post
by cederavic »
Little tricks to execute a procedure with its "pointer"
Code: Select all
;/**
; * Execute and return the @Procedure() passing parms object as parameter
; */
Procedure CallFunction(*proc, *parms)
!if (p_proc!= null) return p_proc(p_parms);
EndProcedure
Procedure TestCall(value.s)
Debug value
ProcedureReturn #True
EndProcedure
Debug CallFunction(@TestCall(), @"lalala")
Although, the SpiderBasic.js need to be cleaned from asm code.
-
Fred
- Site Admin
- Posts: 1510
- Joined: Mon Feb 24, 2014 10:51 am
Post
by Fred »
You should be able to use Prototype natively as well
-
cederavic
- Posts: 30
- Joined: Tue Feb 25, 2014 6:49 am
Post
by cederavic »
ho.. I did not though of that, i'll try
-
Fred
- Site Admin
- Posts: 1510
- Joined: Mon Feb 24, 2014 10:51 am
Post
by Fred »
Here is the code for the record:
Code: Select all
;/**
; * Execute and return the @Procedure() passing parms object as parameter
; */
Procedure TestCall(value.s)
Debug value
ProcedureReturn #True
EndProcedure
Prototype TestCallPrototype(value.s)
FunctionPointer.TestCallPrototype = @TestCall()
FunctionPointer("Hello")
-
cederavic
- Posts: 30
- Joined: Tue Feb 25, 2014 6:49 am
Post
by cederavic »
Works great, Thanks Fred