Archive 17/01/2023.

[SOLVED] Loading xml layouts in lua

Mike

Is the LoadLayout function missing or is there a more generic way to load xml layouts in lua?

cadaver

It has not been exposed so far because it returns shared pointers and needs special handling. But it should be doable, similar to ResourceCache::GetFile().

cadaver

Should be exposed now. As it’s already somewhat of a tradition, I put in also the string filename overload.

When you get the element from LoadLayout, you should either add it to the UI hierarchy, or delete manually. Otherwise there will be a memory leak.

Mike

Many thanks, was not sure if missing function was intentional.
Working with string filename overload makes it really convenient to use :stuck_out_tongue: