I can't figure out how to assign the value of a function to a boolean.
For example, consider this array of functions:
What I want to do is, assign the value of the executed functions to a boolean array.
I tried following Brandons lape tutorial but I'm not sure if the pointer part applies to functions... Heres my code:
Simba Code:
type
PBool = array[0..1] of ^boolean;
var
g:array[0..1] of function:boolean;
bool:Pbool;
ptr:PChar;
i:Integer;
function test1:boolean;
begin
result := false;
end;
function test2:boolean;
begin
result := false;
end;
begin
g := [@test1, @test2];
bool := @g;
for i := 0 to high(g) do
begin
writeln(PBool(ptr)^);
ptr := Ptr + sizeof(Boolean);
end;
end.
I get a acess violation error at
Code:
Exception in Script: Can't assign "^array [0..1] of function():(False=0, True=1)" to "array [0..1] of ^(False=0, True=1)" at line 22, column 8
Probably line