You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis/ScriptAPI/Ll.md
-71Lines changed: 0 additions & 71 deletions
Original file line number
Diff line number
Diff line change
@@ -25,27 +25,6 @@ Some interfaces related to loader operations are provided here.
25
25
- Return value: loader version
26
26
- Return value type: `String`
27
27
28
-
29
-
30
-
### Check LeviLamina version
31
-
32
-
`ll.requireVersion(major[,minor,revision])`
33
-
34
-
- Parameter:
35
-
- major: `Integer`
36
-
Check if the major version number of the currently installed LL is >= this value.
37
-
- minor: `Integer` (optional parameter)
38
-
Check if the minor version number of the currently installed LL is >= this value.
39
-
- revision: `Integer` (optional parameter)
40
-
Check if the revision number of the currently installed LL is >= this value.
41
-
- Return value: Test result
42
-
- Return value type: `Boolean`
43
-
44
-
If the detection finds that the currently installed version of LLSE is lower than the value passed in, it will return `false`.
45
-
You can choose to judge based on the results and report an error to remind users to upgrade their LeviLamina version.
46
-
47
-
48
-
49
28
### Get information about Plugin
50
29
51
30
`ll.getPluginInfo(name)`
@@ -66,27 +45,20 @@ You can choose to judge based on the results and report an error to remind users
66
45
| plugin.filePath | Path to plugin |`String`|
67
46
| plugin.others | Other information |`Object`|
68
47
69
-
70
-
71
-
72
48
### List all loaded plugins
73
49
74
50
`ll.listPlugins()`
75
51
76
52
- Return value: A list containing the names of all loaded plugin
77
53
- Return value type: `Array<String,String,...>`
78
54
79
-
80
-
81
55
### List all loaded plugins with information
82
56
83
57
`ll.getAllPluginInfo()`
84
58
85
59
- Return value: A list containing the plugin objects of all loaded plugin
86
60
- Return value type: `Array<Plugin,Plugin,...>`
87
61
88
-
89
-
90
62
### Remote Function Call
91
63
92
64
In order to allow the pre-plug-ins developed by developers to provide interfaces and services for other plug-ins, the remote function call function is provided here, so that one LLSE plug-in can call the existing functions in another plug-in.
@@ -109,8 +81,6 @@ In order to allow the pre-plug-ins developed by developers to provide interfaces
109
81
110
82
Note: If the namespace and name of the exported function are exactly the same as another already exported function, the export will fail. Please select the namespace and export name appropriately when exporting.
111
83
112
-
113
-
114
84
#### Import Function
115
85
116
86
After you have learned that there is a plug-in exporting function, in order to use the function exported by him, you first need to import this function into your own scripting system.
@@ -128,8 +98,6 @@ LLSE provides the interface import to import functions already exported by other
128
98
129
99
The return value of `ll.import` is a function. When you call this function, the cross-plugin call process will be done automatically in the background. The parameters of the calling function will be wrapped and passed to the remote function, and the return value of this function is the return value returned by the remote function after it has been executed.
130
100
131
-
132
-
133
101
#### Example of Remote Calling Function
134
102
135
103
For example, there is a plug-in that exports a function using the namespace AAA, and the name of the exported function is Welcome
@@ -141,8 +109,6 @@ The parameters of the function will be automatically forwarded to the correspond
141
109
142
110
Notice! When calling a function, you need to ensure that the number and types of parameters you pass in and the parameters accepted by the target function are correct and in one-to-one correspondence. Otherwise, an error will occur.
143
111
144
-
145
-
146
112
### Determine if a remote function has been exported
147
113
148
114
`ll.hasExported(namespace,name)`
@@ -155,41 +121,6 @@ Notice! When calling a function, you need to ensure that the number and types of
155
121
- Return value:Whether the function has been exported
156
122
- Return value type: `Boolean`
157
123
158
-
159
-
160
-
### Set Plugin Dependencies
161
-
162
-
Sometimes, you need to make sure that certain plugins are loaded before your own plugins to use the frontend services provided by them. We call these frontend plugins **library dependencies**.
163
-
164
-
When using the import function mentioned above, you need to pay attention: the premise of being able to import a function is that the pre-plugin to be called has been loaded by LLSE.
165
-
Therefore, you may need to use the following function to set the dependent library, so that the pre-plugins you need are loaded first and the import is successful.
166
-
167
-
LLSE provides the following interface to preload the dependent libraries required by the plugin, download the dependent library files you need from local files, or even from remote HTTP(s) addresses.
(Optional parameter) The path to find and load dependent libraries, see below for instructions.
176
-
- Return value: Whether the dependent library is loaded successfully
177
-
- Return value type: `Boolean`
178
-
179
-
For execution, use `ll.require`, then LLSE will perform the following series of operations:
180
-
181
-
- Search the list of loaded plugins. If the dependent library has been loaded, it will return success directly.
182
-
- Search **plugins** and **plugins/lib** directories, if the corresponding dependent library file is found, load it and return the loading result.
183
-
- If the corresponding dependent library file is not found after the search is completed, and the remotePath parameter is not passed in, it will return directly to failure.
184
-
- Use the HTTP(s) protocol remotePath to request the download address corresponding to the remotePath parameter, and download the dependent library files to the `plugins/lib` directory. If the download fails, return failure.
185
-
- Load the successfully downloaded dependent library file and return the loading result.
186
-
187
-
188
-
189
-
Authors of dependent libraries can host relevant code on stable large websites such as GitHub or Gitee, and provide external links to other developers for remote download.
190
-
191
-
192
-
193
124
### Execute a String as a Script
194
125
195
126
`ll.eval(str)`
@@ -199,5 +130,3 @@ Authors of dependent libraries can host relevant code on stable large websites s
199
130
String to execute as a Script
200
131
- Return value: Execution result
201
132
- Return value type: `Any Type`
202
-
203
-
Different from the above mentioned `ll.require`, the script code executed here is directly executed in the engine corresponding to the current plugin, similar to the eval mechanism of each language.
0 commit comments