Something I was planning on doing with a collection of skins was creating separate pseudo namespaces for imported script functions, since anything imported via `dofile()` will be combined with the current script functions, which restricts function names to ones which won't conflict with others that have been imported. I have many scripts that get used in different combinations so it would be cleaner
This is possible by making a table in the script to be imported, like `local foo = {}`, then adding functions to the table like `foo.someFunc = function(arg)`, then returning the table at the end of the file. While in the parent script importing it with a custom pseudo namespace using `imFunc = dofile(...)`, to be used like `imFunc.someFunc()`.
However in just a simple test of calling such table functions, separate than any dofile imports, it seems Rainmeter doesn't handle table based function names, with an error about 'Not a valid function name'.
I know table keys can't be used directly for inline Lua arguments via INI but I suppose this also extends to the function names themselves?
Example skin:
Example script:
Miscellaneous notes:
- The alternative table function syntax of `function Foo.Txt(arg)` fails similarly.
This is possible by making a table in the script to be imported, like `local foo = {}`, then adding functions to the table like `foo.someFunc = function(arg)`, then returning the table at the end of the file. While in the parent script importing it with a custom pseudo namespace using `imFunc = dofile(...)`, to be used like `imFunc.someFunc()`.
However in just a simple test of calling such table functions, separate than any dofile imports, it seems Rainmeter doesn't handle table based function names, with an error about 'Not a valid function name'.
I know table keys can't be used directly for inline Lua arguments via INI but I suppose this also extends to the function names themselves?
Example skin:
Miscellaneous notes:
- The alternative table function syntax of `function Foo.Txt(arg)` fails similarly.
Statistics: Posted by Crest — 4 minutes ago — Replies 0 — Views 9