SHEVAL returns the output as a list of strings

This commit is contained in:
Gwenhael Le Moine 2023-04-06 14:28:37 +02:00
parent d53b3b6875
commit 0710c33dbf
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -25,11 +25,11 @@ module RplLang
@dictionary.add_word!( ['sheval'],
category,
'( string -- output ) run string in OS shell and put output on stack',
'( string -- list ) run string in OS shell and put output on stack',
proc do
args = stack_extract( [[RplString]] )
@stack << Types.new_object( RplString, "\"#{`#{args[0].value}`}\"" )
@stack << Types.new_object( RplList, `#{args[0].value}`.split("\n").map { |line| "\"#{line}\"" } )
end )
@dictionary.add_word!( ['↴', 'lsto'],