3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

Plugins/Plang: print() takes an expr, not a stmt

This commit is contained in:
Pragmatic Software 2020-07-21 16:56:38 -07:00
parent ee5d5934fe
commit 58e75682b1

View File

@ -53,7 +53,7 @@ sub initialize {
# override the built-in `print` function to send to our output buffer instead # override the built-in `print` function to send to our output buffer instead
$self->{plang}->{interpreter}->add_builtin_function('print', $self->{plang}->{interpreter}->add_builtin_function('print',
[['stmt', undef], ['end', ['STRING', "\n"]]], [['expr', undef], ['end', ['STRING', "\n"]]],
sub { $self->print_override(@_) }); sub { $self->print_override(@_) });
# register the `plang` command # register the `plang` command
@ -104,8 +104,8 @@ sub cmd_plangrepl {
sub print_override { sub print_override {
my ($self, $plang, $context, $name, $arguments) = @_; my ($self, $plang, $context, $name, $arguments) = @_;
my ($stmt, $end) = ($plang->output_value($arguments->[0]), $arguments->[1]->[1]); my ($expr, $end) = ($plang->output_value($arguments->[0]), $arguments->[1]->[1]);
$self->{output} .= "$stmt$end"; $self->{output} .= "$expr$end";
return ['NIL', undef]; return ['NIL', undef];
} }