Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


openDialog_execute is returning nil in 6.3

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
flarn2006
Advanced Cheater
Reputation: 1

Joined: 27 Nov 2012
Posts: 73

PostPosted: Fri Jul 26, 2013 4:57 pm    Post subject: openDialog_execute is returning nil in 6.3 Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25808
Location: The netherlands

PostPosted: Fri Jul 26, 2013 6:23 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
flarn2006
Advanced Cheater
Reputation: 1

Joined: 27 Nov 2012
Posts: 73

PostPosted: Sat Jul 27, 2013 3:39 pm    Post subject: Reply with quote

Thanks, but:
Code:
Error:sa2lua/objfile.lua:88: bad argument #1 to 'open' (string expected, got boolean)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25808
Location: The netherlands

PostPosted: Sat Jul 27, 2013 4:36 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
flarn2006
Advanced Cheater
Reputation: 1

Joined: 27 Nov 2012
Posts: 73

PostPosted: Mon Jul 29, 2013 12:03 am    Post subject: Reply with quote

That worked! Thank you. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites