You shouldn't do this as it's pointless and ugly, but I put this together because I was interested in the idea. The Name function can be used to set or get a string, depending on what parameter you pass to it.
PHP Code:
// string 'type'
#define LENGTH 255
#define BUFFER "a_string_nobody_would_ever_use"
char g_Name[LENGTH];
public void OnPluginStart(){
// We set g_Name with the Name function
Name("Hello world!");
// We get g_Name with the Name function
char NameBuffer[LENGTH] = BUFFER;
Name(NameBuffer);
}
void Name(char[] Name){
// 'get'
if (IsBuffer(Name)){
strcopy(Name, LENGTH, g_Name);
// 'set'
} else {
strcopy(g_Name, LENGTH, Name);
}
}
bool IsBuffer(const char[] s){
return StrEqual(s, BUFFER);
}