convert to Integer before using .times

This commit is contained in:
Gwenhael Le Moine 2021-12-08 13:14:42 +01:00
parent 53e1614081
commit 8ac18e6517
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -59,7 +59,7 @@ module Rpl
# duplicate n first stack entries # duplicate n first stack entries
def dupn( stack, dictionary ) def dupn( stack, dictionary )
stack, args = Rpl::Lang::Core.stack_extract( stack, [%i[numeric]] ) stack, args = Rpl::Lang::Core.stack_extract( stack, [%i[numeric]] )
n = args[0][:value] n = args[0][:value].to_i
stack, args = Rpl::Lang::Core.stack_extract( stack, %i[any] * args[0][:value] ) stack, args = Rpl::Lang::Core.stack_extract( stack, %i[any] * args[0][:value] )
args.reverse! args.reverse!
@ -76,7 +76,7 @@ module Rpl
# push a copy of the given stack level onto the stack # push a copy of the given stack level onto the stack
def pick( stack, dictionary ) def pick( stack, dictionary )
stack, args = Rpl::Lang::Core.stack_extract( stack, [%i[numeric]] ) stack, args = Rpl::Lang::Core.stack_extract( stack, [%i[numeric]] )
n = args[0][:value] n = args[0][:value].to_i
stack, args = Rpl::Lang::Core.stack_extract( stack, %i[any] * args[0][:value] ) stack, args = Rpl::Lang::Core.stack_extract( stack, %i[any] * args[0][:value] )
args.reverse! args.reverse!