But wasn't os.execute platform dependent or something so? I remember to have read about it but I'm totally not sure about it now...synthsin75 wrote: ↑Sun Mar 12, 2023 2:39 am I haven't ever needed to get file attributes, but creating/removing directories can be done with os.execute, like I used in my Switch Icons tool.
To see if a file exists I've been using this:
Code: Select all
function FileExists(path) --win only??
local f = io.open(path, "r")
return f ~= nil and io.close(f)
end
Hmm... Yeah, I can see how in your case it can not worth all the mess for only ensuring the availability of a simple variable... And what about storing your variable as "moho.document.MyVar = value"? Have you tried something like that? Because I've precisely making some test today and, even I would have bet it wasn't to be available for the other environment, I got mixed result (results I still have to confirm) that makes me think it could work. Normally I've used "moho.layer.MyVar = value" in some special cases and it has always worked flawlessly, but with all this Multienvironment of Madness ( ) I thought moho.document could be a better storage option for not being layer dependent. In my case I'd still need to get the string.dumb & load thing to work in order to can use this alternative method, but that's because what I intend to store there are entire functions, but for simple values, that I think is all you could need, maybe simply storing there could do the job. Anyway I'll know it soon, cause I wanted to continue exploring this possibility a little more...synthsin75 wrote: ↑Sun Mar 12, 2023 2:39 am I guess I'm not quite following you. What I'm needing is to have a variable, set by a tool, accessible to a layerscript while rendering. So once the render starts, I'd have the same problem with any other layerscript I try to set and run, right? Unless the value of the variable was hard-coded in the layerscript, i.e. "var = value." Now, I can have a script write a layerscript on the fly, to do that, but that's starting to sound too involved for my purposes.