Original Post
Hello :) I wanted to make a small script language I could use. So I started to try some Pointer Function stuff.. I actually forgot what it's called. Anyway the problem is this. I want to be able to pass unlimited args but I really don't know how I could do that :o. If Anyone can help me with that I can add this to the script thing without problems ;)
#include <windows.h>
#include <stdio.h>
class CScript
{
public:
void AddFunction(int number, void(*callback)(void*, void*))
{
Ccallback[number] = callback;
}
void CallFunction(int number, void *uarg, void *uarg2)
{
Ccallback[number](uarg,uarg2);
}
private:
void(*Ccallback[10])(void*, void*); // void(*Ccallback[10])(void*);
};
void Message(void *arg, void *arg2)
{
char *ParamValue = (char*)arg;
char *ParamValue2 = (char*)arg2;
MessageBox(NULL, ParamValue, ParamValue, MB_OK);
MessageBox(NULL, ParamValue2, ParamValue2, MB_OK);
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
CScript script;
script.AddFunction(1, Message);
script.CallFunction(1, "Yo", "BOEEE");
return 0;
}