Can I access sampler instrument keyzone?

I would like to create a tool to apply a sampler instument DSP destructively.
So the plan is to:

  1. Find instrument keyzone
  2. Sample each key in the keyzone and add it to an instrument at the same key

I am new to Renoise’s Lua api, I could’t find anything keyzone related at first glance…

it’s not called keyzone, unfortunately
look for mappings

4003:-- Access to a sample mapping by index. Use property 'sample_mappings' to
4004:-- iterate over all sample mappings and to query the sample (mapping) count.
4005-renoise.song().instruments[]:sample_mapping(layer, index)
--
4119:-- Sample mappings (key/velocity to sample slot mappings).
4120:-- sample_mappings[LAYER_NOTE_ON/OFF][]. Sample mappings also can 
4121--- be accessed via renoise.song().instruments[].samples[].sample_mapping
4122:renoise.song().instruments[].sample_mappings[], _observable
4123-  -> [read-only, array of tables of renoise.SampleMapping objects]
--
4192:-- 'mappings' to query mapping count.
4193-renoise.song().instruments[].macros[]:mapping(index) 
--
4199:-- Macro name as visible in the GUI when mappings are presents.
4200-renoise.song().instruments[].macros[].name, _observable 
--
4210:-- Macro mappings, target parameters.
4211:renoise.song().instruments[].macros[].mappings[], _observable
4212-  -> [read-only, array of renoise.InstrumentMacroMapping objects]
--
4231:renoise.song().instruments[].macros[].mappings[].parameter
4232-  -> [read-only, renoise.DeviceParameter]
--
4236:renoise.song().instruments[].macros[].mappings[].parameter_min, _observable
4237-  -> [number, 0-1]
4238:renoise.song().instruments[].macros[].mappings[].parameter_max, _observable
4239-  -> [number, 0-1]
--
4242:renoise.song().instruments[].macros[].mappings[].parameter_scaling, _observable
4243-  -> [enum = SCALING]
--
4328:-- Name of the phrase as visible in the phrase editor and piano mappings.
4329-renoise.song().instruments[].phrases[].name, _observable
--
5194:-- General remarks: Sample mappings of sliced samples are read-only: can not be
5195:-- modified. See `sample_mappings[].read_only`
5196-
--
5201:renoise.song().instruments[].sample_mappings[].read_only
5202-  -> [read-only, boolean]
--
5205:renoise.song().instruments[].sample_mappings[].sample
5206-  -> [renoise.Sample object]
--
5209:renoise.song().instruments[].sample_mappings[].layer, _observable
5210-  -> [enum = renoise.Instrument.LAYER]
--
5212:-- Mappings velocity->volume and key->pitch options.
5213:renoise.song().instruments[].sample_mappings[].map_velocity_to_volume, _observable 
5214-  -> [boolean]
5215:renoise.song().instruments[].sample_mappings[].map_key_to_pitch, _observable 
5216-  -> [boolean]
--
5218:-- Mappings base-note. Final pitch of the played sample is:
5219---   played_note - mapping.base_note + sample.transpose + sample.finetune
5220:renoise.song().instruments[].sample_mappings[].base_note, _observable 
5221-  -> [number (0-119, c-4=48)]
--
5224:renoise.song().instruments[].sample_mappings[].note_range, _observable 
5225-  -> [table with two numbers (0-119, c-4=48)]
--
5228:renoise.song().instruments[].sample_mappings[].velocity_range, _observable 
5229-  -> [table with two numbers (0-127)]
--
6112:-- mappings in Renoise, or those that were created by the tool itself.
6113--- Target strings are not verified. When they point to nothing, the mapped MIDI

hope this helps @neutron