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.

Program Announcements / Some simple string accessed variable functions

Author
Message
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Oct 2006 22:33
These functions let you use a string as a variable name, so that you can reference a variable using a string.

eg.


Can be replaced with:



Simply put these functions in an file to include with your project:



and call var_start() at the beginning of your program

I hope it helps somebody

Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 17th Oct 2006 13:44 Edited at: 17th Oct 2006 13:46
[edit] Oops, nevermind.

Pretty cool

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 17th Oct 2006 19:57
Thanks

Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 18th Oct 2006 14:53
this is cool =)

:: 3Ghz Pentium 4 / Hyper Threading, 1024mb RAM, 250GB HDD, 256mb Radeon 9600XT Graphics ::


Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 18th Oct 2006 15:46
I'm an idiot so I'm finding it quite hard to grasp what you're trying to do, but it looks very similar to using arrays.

Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 18th Oct 2006 20:27
It is basically using a string to access an element in an array, but it lets you use any type of variable, and with a little modification would let you use UDTs as well. This lets you effectively use a different variable system which uses a string to access the variable, rather than typing it in.

tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 19th Oct 2006 00:28
Pretty interesting, might be useful to aid in scripting and such.

No deletion functions, though.

I'm not a real programmer but I play one with DBPro!
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Oct 2006 19:26 Edited at: 19th Oct 2006 19:33
@tireius
Here is a new set of commands to add onto the end of the others, which will allow you to delete vars, and also check if they exist:


Here is a list of all commands:


edit:
Now has var_inc_string:

All functions


Login to post a reply

Server time is: 2025-05-13 18:21:28
Your offset time is: 2025-05-13 18:21:28