Author Topic: Passing parameters by constants  (Read 1505 times)

0 Members and 1 Guest are viewing this topic.

Offline Savage

  • Soldier
  • **
  • Posts: 155
Passing parameters by constants
« on: February 16, 2016, 03:05:53 pm »
Code: [Select]
procedure test1(const testnum: Byte);
begin
testnum := 5;
Players.WriteConsole(inttostr(testnum),$FFFFFF);
end;

procedure OnSpeak(Player: TActivePlayer; Text: string);
begin
if text='!test1' then
test1(95);
end;

procedure Init;
var
i: byte;
begin
for i := 1 to 32 do
Players[i].OnSpeak := @OnSpeak;
end;

begin
Init;
end.

Shouldn't that throw me an error?(Something like "Left side cannot be assigned to") It's still able to change the value.
« Last Edit: February 16, 2016, 03:08:11 pm by Savage »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Passing parameters by constants
« Reply #1 on: February 16, 2016, 03:15:34 pm »
It should. You can report it here but since pascalscript is more or less dead, I wouldn't count on anything. It's not a major bug anyway.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.