| View previous topic :: View next topic |
| Author |
Message |
flarn2006 Advanced Cheater
Reputation: 1
Joined: 27 Nov 2012 Posts: 73
|
Posted: Fri Jul 26, 2013 4:57 pm Post subject: openDialog_execute is returning nil in 6.3 |
|
|
I have a script that I wrote that makes use of the open/save dialogs. It works fine in CE 6.2, but in 6.3 it gives me the following error:
| Code: | Error:sa2lua/objfile.lua:79: bad argument #1 to 'open' (string expected, got no value)
|
Is this a bug of some kind? How can I fix it?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25808 Location: The netherlands
|
Posted: Fri Jul 26, 2013 6:23 pm Post subject: |
|
|
It's a bug yes, it looks like the legacy version of opendialog_execute doesn't return a result every time
For 6.3 replace
| Code: |
local file = io.open(openDialog_execute(SpawnedObjList_OpenDlg))
|
with
| Code: |
local file = io.open(SpawnedObjList_OpenDlg.execute())
|
and
| Code: |
local file = io.open(openDialog_execute(SpawnedObjList_SaveDlg), "w+")
|
with
| Code: |
local file = io.open(SpawnedObjList_SaveDlg.execute(), "w+")
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
flarn2006 Advanced Cheater
Reputation: 1
Joined: 27 Nov 2012 Posts: 73
|
Posted: Sat Jul 27, 2013 3:39 pm Post subject: |
|
|
Thanks, but:
| Code: | Error:sa2lua/objfile.lua:88: bad argument #1 to 'open' (string expected, got boolean)
|
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25808 Location: The netherlands
|
Posted: Sat Jul 27, 2013 4:36 pm Post subject: |
|
|
Ah yes, forgot about that
Execute returns true on success and the Filename property gets the filename
You can overide the old broken openDialog_execute with
| Code: |
function openDialog_execute(od)
if od.execute() then
return od.Filename
else
return nil
end
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
flarn2006 Advanced Cheater
Reputation: 1
Joined: 27 Nov 2012 Posts: 73
|
Posted: Mon Jul 29, 2013 12:03 am Post subject: |
|
|
That worked! Thank you.
|
|
| Back to top |
|
 |
|