- Script Code -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
t = {
tracks = {
{
track = "AZ1",
num = -21
},
{
track = "AZ2",
num = -25
},
{
track = "AZ3",
num = -24
}
}
}
Msg(t["tracks"][1].track)
Msg(t["tracks"][1].num)
jsonStr = reaper.AZ_Json_Serialize(t);
Msg(jsonStr)
tb = reaper.AZ_Json_Deserialize(jsonStr);
Msg(tb["tracks"][2].track)
Msg(tb["tracks"][2].num)
- Warm Up -
- Script Detail -
dofile(reaper.AZ_GetLuaInitPath())
require("reaper_AZSTOKE_SILVER")
・Handle enabling the SILVER API
t = {
tracks = {
{
track = "AZ1",
num = -21
},
{
track = "AZ2",
num = -25
},
{
track = "AZ3",
num = -24
}
}
}
・Create an array
※この配列は様々な方法で作られることを想定しています。
Msg(t["tracks"][1].track)
Msg(t["tracks"][1].num)
・Output the first row of the array to the console to check
jsonStr = reaper.AZ_Json_Serialize(t);
Msg(jsonStr)
・Convert the array to a string so it can be saved as text
reaper.AZ_WriteFile("F://script//save","savedate.txt",jsonStr,0)
・Overwrite-save jsonStr as savedate.txt in the specified folder
tb = reaper.AZ_Json_Deserialize(jsonStr);
・Convert jsonStr back into an array.
※これによりそのまま以前の配列を取得できる状態になります。
Msg(tb["tracks"][2].track)
Msg(tb["tracks"][2].num)
・Check whether it was extracted
- API LINK -
- API LINK -
File/Folder
AZSTOKE_TextFileWirteRead2
Save data construction Part 2 - Saving and using JSON format with array structure in mind -









