Raised This Month: $ Target: $400
 0% 

[Terrible Idea] Using the same function to set/get a string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 04-07-2016 , 05:45   Re: [Terrible Idea] Using the same function to set/get a string
Reply With Quote #1

Why not pass string max length as always (default value = 0) and in the function check:

if the length is > 0 - Get
if the length is <= 0 - Set

PHP Code:
SetGetFunction(String:myString[], stringMaxLength 0)
{
    if (
stringMaxLength 0) { // get
        
strcopy(myStringstringMaxLengthSomeStringTakenFromSomewhere);
    } else { 
// set
        
strcopy(SomeStringTakenFromSomewheresizeof(SomeStringTakenFromSomewhere), myString);
    }

P.S.: If you totally want to do this sh*t...
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.

Last edited by KissLick; 04-07-2016 at 05:45.
KissLick is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode