SRL Archive - FAQ

Pointers in Simba?


Bixby Sayz

2011-03-21 21:53:39

Been searching forums repeatedly but can't seem to find a definitive answer.

It appears pointers to functions is supported, but that is it?

This valid pascal code taken from a pascal tutorial fails to compile in Simba (or SCAR for that matter).

program Pointers;

var
i: integer;
p: ^integer;

begin
i := 1;
p := @i;
p^ := 2;
writeln(i);
end.

I found a few posts making vague references to RUTIS but no indication how to switch to it/what the consequences are.

Reason for wanting this: I have a number of global vars that are of a custom type. It would be nice to stuff a pointer to them in the players array somewhere and do away with the global vars.

TomTuff

2011-03-21 22:17:40

An example on how to use:
program new;


procedure WritelnCustom(Func: function: string);
var
S: string;
begin
S := Func();
Writeln(S);
end;

function LoadStr: string;
begin
Result := 'pointer';
end;


begin
WritelnCustom(@LoadStr);
end.

I don't think Simba pointers can be used how you want them to be.

Bixby Sayz

2011-03-21 22:19:02

So it is a limited implementation of pointers then. God I miss C++ when trying to do this shit.

i luffs yeww

2011-03-21 22:23:36

To change the interpreter to RUTIS, Script > Interpreter > RUTIS.

What you have won't work in RUTIS though.

Bixby Sayz

2011-03-21 22:28:10

So again, no pointers in Simba other than pointers to functions?

Sorry to be a nag but all I want is for someone who knows to actually answer YES or NO does it support pointers.

TomTuff

2011-03-21 22:56:21

From: Bixby Sayz
So again, no pointers in Simba other than pointers to functions?

Sorry to be a nag but all I want is for someone who knows to actually answer YES or NO does it support pointers.


YES to an extent, as has been said. lol?

i luffs yeww

2011-03-21 23:26:08

Bixby, as you know, Pascal supports pointers just as you have them. Not entirely sure why PascalScript doesn't, but it must be possible. I think it may sorta be in the works maybe kinda. :p

But if I talk to Wizzup? anytime son I'll try to talk about pointer functionality.

Dgby714

2011-03-21 23:34:11

PascalScript fails… LAPE has them! Its too soon to move to lape tho =|

Wizzup?

2011-03-22 06:33:55

As stated, if you're not doing anything RS-related (read: you don't need SRL) you can switch to the RUTIS interpreter, but this one also lacks some other abilities. As Dgby714 stated, there's light at the end of the tunnel though. ;)

It'll be in eventually.