Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Call function from string variable

Author
Message
Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 6th Feb 2012 16:45
I would like to call a function like this, I change the string variable "current_ui$" to whatever function name I want to call, but obviously it wont work this way as current_ui$ in my main loop wont call the function. Is there a way to do this? Like retrieving the function name from the string variable?



The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 6th Feb 2012 18:10
This is possible with Matrix1 utilities.

Call Function Name current_ui$

Quote: "CALL FUNCTION NAME

Syntax

CALL FUNCTION NAME Function Name$, ...arguments...
Return Value = CALL FUNCTION NAME ( Function Name$, ...arguments... )

Description

Calls the local function named, passing any arguments you have provided (up to 10) to the function being called.

These functions/commands will work for either __cdecl (DBPro or user DLL) or __stdcall (windows DLL) functions safely (... hopefully).

If your called function returns a value, and you need this value, you must store the results directly into a variable to ensure that the returned value is interpreted correct.

In addition, any parameters you pass must be of the correct type expected by your called function (ie, you must pass a float if the function expects a float, and it will not convert an integer for you)."


Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 6th Feb 2012 18:16
Digital web-hug for you Chris Tate Thanks a bunch!

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Feb 2012 19:55
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Feb 2012 22:49
I'd blame your avatar.
Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 6th Feb 2012 23:01
But IanM, you just made the stuff happen, why would I hug you for that? Just kidding, a VERY big hug for you IanM, your plugin have already saved me in the past too

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Cybermind
Valued Member
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 6th Feb 2012 23:03
Green Gandalf: My avatar thinks your avatar looks yummie... He keeps asking me where his file location is

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...

Login to post a reply

Server time is: 2026-07-10 09:57:24
Your offset time is: 2026-07-10 09:57:24