Grayswandir
12-25-2016, 11:23 AM
So, I've been making some progress to adding function pointers to zscript: https://github.com/gwx/ZeldaClassic/tree/function-pointers
void test() {
Trace(-99);
}
void test(int x) {
Trace(x);
}
global script Active {
void run() {
int f = @test;
f();
f = @test(int);
f(-50);
}
}
Up until now, I've been focusing on getting it to work (which it does), but not any aspects of type safety.
So, continuing forward, I figure I can either add vaguely C style types:
int(bool, int) x = @test;
Or model it after angelscript's approach:
funcdef int TYPE_NAME(bool, int);
// ...
TYPE_NAME x = @test;
Any preferences on which, or other considerations?
void test() {
Trace(-99);
}
void test(int x) {
Trace(x);
}
global script Active {
void run() {
int f = @test;
f();
f = @test(int);
f(-50);
}
}
Up until now, I've been focusing on getting it to work (which it does), but not any aspects of type safety.
So, continuing forward, I figure I can either add vaguely C style types:
int(bool, int) x = @test;
Or model it after angelscript's approach:
funcdef int TYPE_NAME(bool, int);
// ...
TYPE_NAME x = @test;
Any preferences on which, or other considerations?