Class: AmberVM::Functions::SetAt
- Defined in:
- lib/amber/functions/array/set_at.rb
Overview
This Function is used to set a element of a List on a specific position. The List is passed as first and the position, a Number, passed as second parameter.
Class Method Summary collapse
Methods inherited from Function
call, data_type, execargs, method_missing
Methods included from Plugin
#helper, #included, #plugin_host, #plugin_id, #register_for
Class Method Details
.execute(params, env) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/amber/functions/array/set_at.rb', line 33 def SetAt.execute params, env if params.length == 3 array = params.shift pos = params.shift value = params.shift array[pos.to_i] = value else AmberVM::Classes[:error].new(1,"FUNCTION (#{self.class}) EXPECTS 3 ARGUMENTS BUT GOT #{params.length}") end end |