*** ./recorder.lua:82: attempt to index field '?' (a nil value)
*** stack traceback:
*** ./recorder.lua:82: in function <./recorder.lua:79>
so, what should i do, can i set some sort of a “create notifier before starting sampling, use notifier to set sample preferences, delete notifier” mess?
i’m still sure this is some sort of notifier thing. but i worrry about notifiers, i’d prefer to not have them confuse the matter of starting Renoise - if i start Renoise and the notifier runs and shoots an error, its’ been done in the wrong way, right?
local sng=renoise.song()
local sii=sng.selected_instrument_index
local ssi=sng.selected_sample_index
local sam=sng:instrument(sii):sample(ssi)
sam.autofade=true
sam.interpolation_mode=4
sam.oversample_enabled=true
However, the API allows “shortcuts”. Also, the example above is not error-proofed. Renoise has fixed elements, which always exist, and elements that may or may not exist. For the latter case, you must first check if it exists. This way you avoid mistakes.
With check and shortcut:
local sam=renoise.song().selected_sample --api shortcut
if (sam) then --check!
sam.autofade=true
sam.interpolation_mode=4
sam.oversample_enabled=true
else
print(This sample not exist, Please check if it exist before!!!)
end