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:
parent
ee5d5934fe
commit
58e75682b1
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user