This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Feature Updates
 Closed or Deferred Requests
 [CLOSED] Reload global script file
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

breakcore

Russia
74 Posts

Posted - 01/01/2013 :  11:00:32  Show Profile
I recently found out that the global lua script can be nicely edited in notepad++, but for any changes to take effect you need to open S+ config dialog and press ok.
I think it would be good to have the function like acReloadConfig() but for the global script.
Thanks!

Rob

USA
2615 Posts

Posted - 01/01/2013 :  11:11:45  Show Profile  Visit Rob's Homepage
Unfortunately this cannot be done via Lua because the Lua state needs to be reloaded to properly reinitialize the Global Lua (and all actions in S+ occur within Lua). Somewhere someone asked something similar, I thought "Yea, that seems like a good idea!" and added it to the code, only to realize that it causes S+ to crash because it's trying to reload the Lua state while the Lua state is executing.

Alternatively, you can right-click the S+ tray icon and click Reload Config and Lua Engine
Go to Top of Page

breakcore

Russia
74 Posts

Posted - 01/01/2013 :  11:50:29  Show Profile
Understood.
Somehow I missed that tray menu item, thanks!
Go to Top of Page

Rob

USA
2615 Posts

Posted - 01/01/2013 :  12:14:25  Show Profile  Visit Rob's Homepage
While I don't have the code, you can create a function which calls the Lua loadfile function:
http://www.lua.org/manual/5.1/manual.html#pdf-loadfile

I used to have a snippet around, but can't seem to find it. Essentially, it executes the Lua code in the file...similar to reloading the state from the tray, but only executes the code, so it's on you if there are conflicts to redefining functions or something.

However, you can have it load a different file, to keep the internal StrokesPlus.lua stuff separate. Maybe have a function in Global Lua which loads this file into Lua and call it in Global Lua (so when S+ opens, it runs the stuff in the file). Then you could create an action which also calls the function, to re-execute the contents of the file whenever you want.

As I said, I'm not sure how well it will work, but there's nothing technically wrong with doing it; really just a matter of how Lua functions/handles things being redefined...it may very well handle it gracefully, replacing any existing functions, etc.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 01/02/2013 :  01:55:57  Show Profile  Visit Rob's Homepage
Ah, I did make a post under Did You Know:

http://www.strokesplus.com/forum/topic.asp?TOPIC_ID=376
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000