print or save in pdf?

  • #10, by afrlmeSunday, 26. September 2021, 16:44 2 years ago
    I know how to create a folder on windows in the documents folder, but the problem is that I don't think that would be valid for mac & linux. I have no idea if the folders would be named/accessed in the same way because the method I've shown below is using the environment variables which are - as far as I'm aware - unique to each different OS.

    Anyway, to create a folder on the desktop (on windows at least) you can use this code...
    local dir = os.getenv("userprofile") .. "\\Documents\\"
    lfs.mkdir(dir .. "\\Example Game Name")
    lfs.mkdir(dir .. "\\Example Game Name\\Screenshots")
    
    local time = os.date("%Y-%m-%d_%Hh-%Mm-%Ss")
    createScreenshot(dir .. "\\Example Game Name\\screenshots\\" .. time .. ".png")

    Imperator

    7278 Posts


  • #11, by jf-mWednesday, 17. November 2021, 17:07 2 years ago
    Hi afrlme!

    A few weeks have passed since i have asked you a print solution.
    I just have finished a new (small) game which requires this print solution.
    I have tried your last one, and it works fine if i build my game on a windows platform.
    The problem is, it doesn't if i build the game on html5 platform which is the one i have to use.

    Do you have any other idea? smile 

    once again, many thanks! smile

    Newbie

    39 Posts