Idea is simple - making TDictionary with class name to TComponent to use
for enum in vm.ClassNameToComponent do
TLuaClassTemplate<enum.Value>.RegisterClass(vm.LS, PrintGlobal, container, vm);
with enum instead of
TLuaClassTemplate<TButton>.RegisterClass(vm.LS, PrintGlobal, container, vm);
TLuaClassTemplate<TPanel>.RegisterClass(vm.LS, PrintGlobal, container, vm);
TLuaClassTemplate<TEdit>.RegisterClass(vm.LS, PrintGlobal, container, vm);
...
and to use class name taken from xml to work with generic based classes.
But there is problem:
TClassNameToComponentDict = TDictionary<string, TComponent>;
...
ClassNameToComponent: TClassNameToComponentDict;
...
ClassNameToComponent := TClassNameToComponentDict.Create;
ClassNameToComponent.Add('TButton', TButton);
ClassNameToComponent.Add('TPanel', TPanel);
ClassNameToComponent.Add('TEdit', TEdit);
...
error "Incompatible types 'TComponent' and 'class of TButton'".
How to use "class of" like TButton etc as generic value?