FormChina wrote:
...
Is necessary to increase the function of mapping function
Like this:
MapFunc(“Function Msgbox(MsgStr as string) as long”,AddressOf(MyMsgbox))
Script:
Msgbox("Call functions for EXE")
...
Thank you for the appreciation of FBSL.
Still I must point out that FBSL was not designed just to randomly replicate the constructs used in other languages (AngelScript or Lua or whichever else can be found in the web). In very many cases, FBSL provides its own means to produce the same effect. In fact, in many cases you have not just one choice but rather a variety of choices, and this is why it is called a "freestyle" language.
For example, if you have your own user function and you want to use it instead of FBSL's standard function, you just override the standard function by assigning its name to your own function, e.g.
Code:
Function MsgBox(MsgStr As String) As Integer
Dim whatever As Integer
...
(you code goes here)
...
Return whatever
End Function
and you may use it throughout your code instead of the standard MsgBox function
without any additional mapping. This method is called "overriding".
Please note that FBSL doesn't recognize any VB-like "Long"'s -- FBSL's "Integer" is an equivalent to a VB "Long". Besides, FBSL's valid syntax for AddressOf is "AddressOf SomeFunction"
without any brackets or braces or whatever. Also, you can't use back/forward-slashed quotes (
“...
”) in your code -- you'll get an error message. You are supposed to use straight quotes (
"...
") only.
Secondly, if you have your own user function "Function MyMsgbox(MsgStr As String) As
Integer" and for some reason you don't like the name "MyMsgbox" any more, you may redefine it like this:
Code:
#Define MsgBox MyMsgbox
and the FBSL preprocessor will make all the necessary substitutions for you.
Thirdly, you may use the "Macro" definition like this:
Code:
Macro MsgBox(MsgStr) = MyMsgbox(MsgStr)
to exactly the same effect.
Thus, FBSL already provides
at least three ways to achive the result you are advocating.
As a co-author of FBSL, I don't see any reason why I should add a fourth way to do the same.