Skip to content

Commit b3b3204

Browse files
committed
Update meter_set_numeric.lua
Localized all top-level functions
1 parent d12ff6a commit b3b3204

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/meter_set_numeric.lua

+15-16
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ function plugindef()
33
finaleplugin.Author = "Carl Vine"
44
finaleplugin.AuthorURL = "https://carlvine.com/lua/"
55
finaleplugin.Copyright = "https://creativecommons.org/licenses/by/4.0/"
6-
finaleplugin.Version = "0.82"
7-
finaleplugin.Date = "2024/01/25"
6+
finaleplugin.Version = "0.83"
7+
finaleplugin.Date = "2024/01/27"
88
finaleplugin.MinJWLuaVersion = 0.60
99
finaleplugin.Notes = [[
1010
This script allows rapid creation of simple or complex
@@ -90,29 +90,29 @@ local config = {
9090
}
9191
configuration.get_user_settings(script_name, config, true)
9292

93-
function blank_meter()
93+
local function blank_meter()
9494
return { -- empty composite meter record
9595
main = { top = {}, bottom = {} },
9696
display = { top = {}, bottom = {} }
9797
}
9898
end
9999

100-
function dialog_set_position(dialog)
100+
local function dialog_set_position(dialog)
101101
if config.window_pos_x and config.window_pos_y then
102102
dialog:StorePosition()
103103
dialog:SetRestorePositionOnlyData(config.window_pos_x, config.window_pos_y)
104104
dialog:RestorePosition()
105105
end
106106
end
107107

108-
function dialog_save_position(dialog)
108+
local function dialog_save_position(dialog)
109109
dialog:StorePosition()
110110
config.window_pos_x = dialog.StoredX
111111
config.window_pos_y = dialog.StoredY
112112
configuration.save_user_settings(script_name, config)
113113
end
114114

115-
function user_chooses_meter(meter, rgn)
115+
local function user_chooses_meter(meter, rgn)
116116
local x = { 0, 70, 130, 210, 280, 290 } -- horizontal grid
117117
local label = { -- data type descriptors and (range right) horizontal offset
118118
{ "PRIMARY", 0}, -- name, horiz (left) offset
@@ -238,7 +238,7 @@ function user_chooses_meter(meter, rgn)
238238
return ok, choices
239239
end
240240

241-
function encode_current_meter(time_sig, sub_meter)
241+
local function encode_current_meter(time_sig, sub_meter)
242242
local function numerators_treble(top_table)
243243
for j = 1, #top_table do
244244
top_table[j] = top_table[j] * 3
@@ -281,7 +281,7 @@ function encode_current_meter(time_sig, sub_meter)
281281
end
282282
end
283283

284-
function copy_meter_from_score(measure_number)
284+
local function copy_meter_from_score(measure_number)
285285
local measure = finale.FCMeasure()
286286
measure:Load(measure_number)
287287
local meter = blank_meter()
@@ -292,15 +292,15 @@ function copy_meter_from_score(measure_number)
292292
return meter
293293
end
294294

295-
function is_power_of_two(num)
295+
local function is_power_of_two(num)
296296
local current = 1
297297
while current < num do
298298
current = current * 2
299299
end
300300
return current == num
301301
end
302302

303-
function convert_choices_to_meter(choices, meter)
303+
local function convert_choices_to_meter(choices, meter)
304304
if choices[1] == "0" or choices[1] == "" or choices[4] == 0 then
305305
return "Primary time signature cannot be zero"
306306
end
@@ -343,7 +343,7 @@ function convert_choices_to_meter(choices, meter)
343343
return "" -- no error
344344
end
345345

346-
function new_composite_top(sub_meter)
346+
local function new_composite_top(sub_meter)
347347
local composite_top = finale.FCCompositeTimeSigTop()
348348
for count = 1, 3 do
349349
if not sub_meter[count] or sub_meter[count][1] == 0 then break end
@@ -356,7 +356,7 @@ function new_composite_top(sub_meter)
356356
return composite_top
357357
end
358358

359-
function new_composite_bottom(sub_meter)
359+
local function new_composite_bottom(sub_meter)
360360
local composite_bottom = finale.FCCompositeTimeSigBottom()
361361
for count = 1, 3 do
362362
if not sub_meter[count] or sub_meter[count] == 0 then break end
@@ -367,8 +367,7 @@ function new_composite_bottom(sub_meter)
367367
return composite_bottom
368368
end
369369

370-
371-
function fix_new_top(composite_top, time_sig, numerator)
370+
local function fix_new_top(composite_top, time_sig, numerator)
372371
if composite_top ~= nil then -- COMPOSITE top
373372
time_sig:SaveNewCompositeTop(composite_top)
374373
else
@@ -380,7 +379,7 @@ function fix_new_top(composite_top, time_sig, numerator)
380379
end
381380
end
382381

383-
function fix_new_bottom(composite_bottom, time_sig, denominator)
382+
local function fix_new_bottom(composite_bottom, time_sig, denominator)
384383
if composite_bottom ~= nil then -- COMPOSITE bottom
385384
time_sig:SaveNewCompositeBottom(composite_bottom)
386385
else
@@ -392,7 +391,7 @@ function fix_new_bottom(composite_bottom, time_sig, denominator)
392391
end
393392
end
394393

395-
function create_new_meter()
394+
local function create_new_meter()
396395
local region = mixin.FCMMusicRegion()
397396
region:SetRegion(finenv.Region()):SetStartMeasurePosLeft():SetEndMeasurePosRight()
398397

0 commit comments

Comments
 (0)