Jump to content

Lua question on file checking


Recommended Posts

Why doesn't this work as a Do Script File or even DoScript:

 

name = "C:\\DCS\\Test.txt"

if file_exists(name) then blah blah

......

......

 

function file_exists(name)

f = io.open(name,"r")

if f then

return false

else

io.close(f)

return true

end

end

 

I get error message at f = io.open(name, "r") as

"attempt to index 'io' (a nil value)

 

It works in LuaEdit 2010

klem

56 RAF 'Firebirds'

ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit

Link to comment
Share on other sites

io,lfs and os functions are blocked in mission scripts to prevent missions stealing your credit card or wreking your harddrive :)

there is a way to deactivate those protections (see '\Scripts\MissionScripting.lua') but its on a 'per person basis' so even if you do it everyone who wants to play your mission has to do it himself

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Link to comment
Share on other sites

io,lfs and os functions are blocked in mission scripts to prevent missions stealing your credit card or wreking your harddrive :)

there is a way to deactivate those protections (see '\Scripts\MissionScripting.lua') but its on a 'per person basis' so even if you do it everyone who wants to play your mission has to do it himself

 

Thanks for the explanation Nero.ger

klem

56 RAF 'Firebirds'

ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit

Link to comment
Share on other sites

  • Recently Browsing   0 members

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