Jump to content

cannot write file with io.open() .write() .close()


0xDEADBEEF

Recommended Posts

Hi guys!

 

I'm going circles! I'm trying to write a file like this:

local function exportstats()
local exportData = "text"
exportFile = io.open("file.lua", "w")
exportFile:write(exportData)
exportFile:close()
end

 

at first io and lfs were sanitized, i commented the two lines in MissionScripting.lua

then the file would still not open, although io not being nil, io.open() returned nil, launching DCS in Admin mode solved this error.

 

So now the script runs error free, but there is no file anywhere :huh:

 

I got absolutely no clue whats wrong ... any help is very much appreciated!

thanks!

beef

Link to comment
Share on other sites

Does it work with an absolute path?

 

I would guess its somewhere in the dcs program folder if its requiring admin privileges.

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

i wonder why I didnt look there in the first place :O

thanks mate!

 

is there any variable/function/reference to the missions folder in saved games? I don't quite feel like typing an absolute path on my harddrive, in case I ever move it to a server it wont work anymore ...

Link to comment
Share on other sites

Not that I know of, sorry!

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Now that the file is there (i expected the windows search to be more exact) my brain works sufficiently again to find how to find out the current directory: lfs.writedir() returns a string to the current directory.

 

thanks for your help!


Edited by 0xDEADBEEF
deleted wrong assumtion
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...