File SMReflection.mys

MyrScript reflection, v 1.7.4 Reflective programming or reflection is the ability of a script to examine, introspect, and modify its own structure.


In other words, these functions answer questions like 'What are the properties of a Staff?'

These functions are not included in SMUtils, because rarely needed, and this file is auto-generated.

Usage


 IncludeOnce("SMReflection")
 local tab = ReflectionGetFields("Staff")
 for i=1,getn(tab) do
   print(tab[i].." = ".. tostring(FrontScore().FirstStaff[tab[i]]))
 end

Section

SectionSummary
ReflectionMyrScript reflection Reflective programming or reflection is the ability of a script to examine, introspect, and modify its own structure.

Summary

Return typeFunction and summary
tableReflectionGetFields(string obj)
Get the properties (fields) of a MyrScript objects, like NumberOfBars for Score object.
tableReflectionGetMethods(string obj)
Get the functions (methods) of a MyrScript objects, like EditComments for Score object.
tableReflectionGetObjects()
Return list of MyrScript objects: Application, Score, Staff, Instrument...
tableReflectionGetStaticFunctions()
Get list of static functions, that are not part of object, like PurgeStringStyle, BinAnd...

Functions

ReflectionGetObjects()

Return list of MyrScript objects: Application, Score, Staff, Instrument...

Return
table: table

ReflectionGetStaticFunctions()

Get list of static functions, that are not part of object, like PurgeStringStyle, BinAnd...

Return
table: table

ReflectionGetFields(string obj)

Get the properties (fields) of a MyrScript objects, like NumberOfBars for Score object.

ParameterTypeDefaultDescription
objstring Object, e.g. "Score", "Staff", "Instrument"
Return
table: nil if obj doesn't exist

ReflectionGetMethods(string obj)

Get the functions (methods) of a MyrScript objects, like EditComments for Score object.

ParameterTypeDefaultDescription
objstring Object, e.g. "Score", "Staff", "Instrument"
Return
table: nil if obj doesn't exist