[JW Lua] List JW Lua Constants
Jari Williamsson
jari.williamsson at mailbox.swipnet.se
Tue Sep 10 23:43:04 CEST 2013
Hello All!
The JW Lua constants aren't listed in the Class Browser, but here's an
attached script that can list them in the console. The constants are
searchable, so if you for example just enter "BARLINE" you'll get the
barline constants.
(Btw, there should no need to understand how this script actually works.
;-) It peeks into the internals of Lua in a way that isn't of much use
for regular script writing.)
Best regards,
Jari Williamsson
-------------- next part --------------
function plugindef()
-- This function and the 'finaleplugin' namespace
-- are both reserved for the plug-in definition.
finaleplugin.NoStore = true
finaleplugin.Author = "Jari Williamsson"
finaleplugin.CategoryTags = "Debug, Development, Diagnose, UI"
return "List JW Lua Constants", "List constants", "Lists the constants available to JW Lua."
end
-- Show dialog
local dialog = finenv.UserValueInput()
dialog.Title = "List JW Lua Constants"
dialog:SetTypes("String")
dialog:SetDescriptions("Search string (empty to list all):")
local returnvalues = dialog:Execute()
if returnvalues == nil then return end
local pattern = returnvalues[1]
local result = {}
-- Search for constants
for k,v in pairs(_G.finale) do
if string.find(k, "__propget") == 1 and (type(v) == "table") then
for k1, v1 in pairs(v) do
if string.find(k1, returnvalues[1]) or returnvalues == "" then
table.insert(result, k1)
end
end
end
end
-- Present sorted result:
table.sort(result)
print("Searching for <", pattern, "> in JW Lua constants:")
for k, v in pairs(result) do
print(v)
end
More information about the JWLua
mailing list