Posts: 95
Threads: 16
Joined: Aug 2019
Reputation:
0
04.05.2023, 11:19
(This post was last modified: 04.05.2023, 11:20 by a455115.)
Hello,
Is it possible for a resident script to be executed from a file that is uploaded to a device and not be visible in the window of the LM?
Posts: 7763
Threads: 42
Joined: Jun 2015
Reputation:
447
You can use a user library with "Keep source" disabled.
Posts: 95
Threads: 16
Joined: Aug 2019
Reputation:
0
Can you give me some details?
How do I activate it? Can I change it if I need to?
Sorry for the stupid questions!
Posts: 95
Threads: 16
Joined: Aug 2019
Reputation:
0
Thank you so much!
Am I to understand that if I have the library saved, make changes and set it to the same name, it will overwrite the original library? Is this code backed up with the project?
Posts: 7763
Threads: 42
Joined: Jun 2015
Reputation:
447
Without "Keep source" only the compiled bytecode library is saved. The editor will be empty in this case because the source is not kept. You can put new code there and it will overwrite the current library. The backup will include such library but without the source code of course.
Posts: 95
Threads: 16
Joined: Aug 2019
Reputation:
0
This is exactly what I needed.
Do I have to write this code (fn = require('user.my_user_library')fn()) in a resident script to call the library?
Posts: 4646
Threads: 24
Joined: Aug 2017
Reputation:
207
An example. I created user library with name 'test'
This is the library:
Code:
return function()
log('test')
end
Each time it is called it will create log 'test'
To cal it create a resident or any other script and use this code.
Code:
fn = require('user.test')
fn()
------------------------------
Ctrl+F5
Posts: 95
Threads: 16
Joined: Aug 2019
Reputation:
0
Thanks a lot, now I understand how it works.