Code execution method, device and computer readable storage medium

By using code blocks and sandbox mechanisms in three-dimensional virtual scenes, users can modify the code content in the code running state, solving the problem that users in the existing technology need to stop the program running when modifying the code, and improving the modification efficiency and user experience.

CN114879967BActive Publication Date: 2025-04-11XIONGAN GUOJI CREATIVE INTERNET CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210451406.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2025-04-11
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

In the prior art, when the code is in the running state, users need to stop the program from running when modifying the code content, which affects the efficiency and user experience of modifying the code.

Method used

By using code blocks and sandbox mechanisms in a three-dimensional virtual scene, users can obtain code blocks by receiving running instructions when the code is in the running state, generate code block tables, and compile and execute code in the sandbox to modify the running code.

Benefits of technology

Allows users to modify the code content without stopping the code to run, improving the efficiency and user experience of users to modify the code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114879967B_ABST
    Figure CN114879967B_ABST
Patent Text Reader

Abstract

The present application discloses a code running method, device and computer-readable storage medium, which are used to improve the efficiency of user code modification, thereby improving user experience. The present application method includes: receiving a first running instruction, the first running instruction carries a unique identifier of a first code block in a three-dimensional virtual scene; according to the first running instruction, obtaining a first code block, the first code block includes a first code editing page and a first sandbox, and the first code editing page stores the first code; obtaining a global table of the three-dimensional virtual scene, the global table stores information of the global code of the three-dimensional virtual scene; according to the first code and the global table, generating a first code block table of the first code block in the first sandbox, the first code block table includes information of the global table and information of the first code; compiling and executing the first code in the first code block table through the first sandbox.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a code running method, device and computer-readable storage medium. Background Art

[0002] The code is a source file written by programmers in the language supported by the development tool. It is a set of clear rules that use characters, symbols or signal code elements to represent information in discrete form.

[0003] In the prior art, when a system runs a section of code, it will lock the code and then perform corresponding processing such as compiling and executing the code.

[0004] However, when a piece of code is in a running state, if the user needs to modify the content of the code, the program needs to be stopped first before the code content can be modified, which affects the efficiency of the user's code modification and reduces the user experience. Summary of the invention

[0005] The present application provides a code running method, device and computer-readable storage medium, which can improve the efficiency of user modification of code, thereby improving user experience.

[0006] The first aspect of the present application provides a code running method, comprising:

[0007] receiving a first running instruction, wherein the first running instruction carries a unique identifier of the first code block in the three-dimensional virtual scene;

[0008] According to the first running instruction, the first code block is acquired, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code;

[0009] Acquire a global table of the three-dimensional virtual scene, wherein the global table stores information of a global code of the three-dimensional virtual scene;

[0010] Generate a first code block table of the first code block in the first sandbox according to the first code and the global table, wherein the first code block table includes information of the global table and information of the first code;

[0011] The first code in the first code block table is compiled and executed by the first sandbox.

[0012] Optionally, after generating a first code block table of the first code block in the first sandbox according to the first code and the global table, and before compiling and executing the first code in the first code block table by the first sandbox, the method further includes:

[0013] The information of the first code in the first code block table is sent to a code sharing area in the three-dimensional virtual scene, where the code sharing area is used to store the code in the code block before it is compiled and executed.

[0014] Optionally, after sending the information of the first code in the first code block table to the code sharing area in the three-dimensional virtual scene, the method further includes:

[0015] receiving a second running instruction, wherein the second running instruction carries a unique identifier of a second code block in the three-dimensional virtual scene;

[0016] According to the second running instruction, the second code block is obtained, wherein the second code block includes a second code editing page and a second sandbox, the second code editing page stores a second code, and the second code includes a target code segment, and the target code segment is used to call the first code;

[0017] Obtaining a global table of the three-dimensional virtual scene;

[0018] Generate a second code block table of the second code block in the second sandbox according to the second code and the global table, wherein the second code block table includes information of the global table and information of the second code;

[0019] The second code in the second code block table is compiled and executed by the second sandbox, wherein the first code in the code sharing area is called when the target code segment is compiled.

[0020] Optionally, after the second code in the second code block table is compiled and executed by the second sandbox, the method further includes:

[0021] receiving an editing instruction, wherein the editing instruction carries information of a target character string;

[0022] According to the editing instruction, input the target character string in the second code editing page;

[0023] Determine whether there is a matching code matching the target character string in the second code block table and the code sharing area;

[0024] If so, the matching code is displayed on the second code editing page.

[0025] Optionally, the determining whether there is a matching code matching the target character string in the second code block table and the code sharing area comprises:

[0026] Using the target character string as a search keyword, traversing and searching the second code block table and the code sharing area;

[0027] Determine whether at least one search result is obtained;

[0028] If so, the at least one search result is determined to be a matching code.

[0029] Optionally, after the first code in the first code block table is compiled and executed by the first sandbox, the method further includes:

[0030] Stop the operation of the first sandbox;

[0031] The first code in the code sharing area is deleted.

[0032] Optionally, generating a first code block table of the first code block in the first sandbox according to the first code and the global table includes:

[0033] copying the global table and the first code to the first sandbox;

[0034] The copied first code is added to the copied global table to generate a first code block table.

[0035] A second aspect of the present application provides a code execution device, including:

[0036] A receiving unit, configured to receive a first running instruction, wherein the first running instruction carries a unique identifier of the first code block in the three-dimensional virtual scene;

[0037] A first acquisition unit is used to acquire the first code block according to the first running instruction, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code;

[0038] A second acquisition unit, configured to acquire a global table of the three-dimensional virtual scene, wherein the global table stores information of a global code of the three-dimensional virtual scene;

[0039] a generating unit, configured to generate a first code block table of the first code block in the first sandbox according to the first code and the global table, wherein the first code block table includes information of the global table and information of the first code;

[0040] The first running unit is configured to compile and execute the first code in the first code block table through the first sandbox.

[0041] The third aspect of the present application provides a code execution device, including:

[0042] Processor, memory, input-output unit, and bus;

[0043] The processor is connected to the memory, the input and output unit, and the bus;

[0044] The memory stores a program, and the processor calls the program to execute the code running method in the first aspect and any possible implementation manner of the first aspect.

[0045] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the computer executes the code running method in the first aspect and any possible implementation of the first aspect.

[0046] It can be seen from the above technical solutions that this application has the following advantages:

[0047] The code running method provided by the present application can obtain the first code block to be run in the three-dimensional virtual scene according to the first running instruction after receiving the first running instruction, then obtain the global table of the three-dimensional virtual scene, and then generate the first code block table in the first sandbox of the first code block according to the global table and the first code, and finally compile and execute the first code in the first code block table in the first sandbox. Since the method compiles and executes the first code in the first code block table, the first code in the first code block table is locked, so that the user can modify the first code in the first code editing machine page while the first code in the first code block table is in the running stage, which improves the efficiency of the user modifying the code and improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solution in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0049] Figure 1 This is a flowchart of an embodiment of the code running method in this application;

[0050] Figure 2 This is a flowchart of another embodiment of the code running method in this application;

[0051] Figure 3 This is a flowchart of another embodiment of the code running method in this application;

[0052] Figure 4 This is a schematic diagram of the structure of an embodiment of a code running device in this application;

[0053] Figure 5This is a schematic diagram of the structure of another embodiment of the code running device in this application;

[0054] Figure 6 A schematic diagram of the structure of another embodiment of the code running device in the present application. DETAILED DESCRIPTION

[0055] The present application provides a code running method, device and computer-readable storage medium for improving the efficiency of user modification of code, thereby improving user experience.

[0056] It should be noted that the code running method provided in this application can be applied to a terminal or a server. The terminal can be a mobile terminal such as a smart phone, a tablet computer, a smart watch, or a fixed terminal such as a desktop computer. For the convenience of description, this application uses the terminal as the execution subject for example.

[0057] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of the code running method provided by the present application, and the code running method includes:

[0058] 101. A terminal receives a first operation instruction, where the first operation instruction carries a unique identifier of a first code block in a three-dimensional virtual scene;

[0059] In actual applications, the user can send the first operation instruction to the terminal in a variety of ways, such as inputting the first operation instruction to the terminal through an input device that is wirelessly or wiredly connected to the terminal, sending the first operation instruction to the terminal through a host that is data-connected to the terminal, etc. The specific method is not limited here. The first operation instruction carries a unique identifier of the first code block in the three-dimensional virtual scene. The three-dimensional virtual scene is a virtual scene with blocks as basic units, and the blocks that constitute the three-dimensional virtual scene include multiple types.

[0060] 102. The terminal obtains a first code block according to the first running instruction, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores the first code;

[0061] Because the first run instruction carries a unique identifier of the first code block in the three-dimensional virtual scene, the terminal can obtain the first code block in the three-dimensional virtual scene according to the unique identifier. The first code block belongs to a code block, which is a block included in the three-dimensional virtual scene, and the code block includes a code editing page and a sandbox. The first code block includes a first code editing page and a first sandbox, and the first code editing page stores the first code.

[0062] 103. The terminal obtains a global table of the three-dimensional virtual scene;

[0063] If the terminal wants to run the first code in the first code block, it may also need the global variables and global functions of the three-dimensional virtual scene, and the global variables and global functions of the three-dimensional virtual scene are all stored in the global table. Therefore, the terminal will obtain the global table.

[0064] 104. The terminal generates a first code block table of the first code block in the first sandbox according to the first code and the global table;

[0065] After acquiring the global table of the three-dimensional virtual scene, the terminal may generate a first code block table of the first code block in the first sandbox, where the first code block table includes information of the global table and information of the first code.

[0066] 105. The terminal compiles and executes the first code in the first code block table through the first sandbox.

[0067] After the terminal generates the first code block table in the first sandbox, the terminal can compile the first code block table in the first sandbox. If there is no compilation error, the content of the first code in the first code block table can continue to be executed. If there is a compilation error, a pop-up window error report, an error report file can be generated, and an error report prompt (such as a prompt sound or vibration, etc.) can be selectively issued to prompt the user that the compilation error needs to be modified.

[0068] In this embodiment, after receiving the first running instruction, the terminal can obtain the first code block that needs to be run in the three-dimensional virtual scene according to the first running instruction, then obtain the global table of the three-dimensional virtual scene, and then generate the first code block table in the first sandbox of the first code block according to the global table and the first code, and finally compile and execute the first code in the first code block table in the first sandbox. Since this method compiles and executes the first code in the first code block table, the first code in the first code block table is locked, so that the user can modify the first code in the first code editing machine page while the first code in the first code block table is in the running stage, which improves the efficiency of the user modifying the code and improves the user experience.

[0069] See also Figure 2 , Figure 2 This is a flow chart of another embodiment of the code running method provided by the present application, and the code running method includes:

[0070] 201. A terminal receives a first running instruction, where the first running instruction carries a unique identifier of a first code block in a three-dimensional virtual scene;

[0071] 202. The terminal obtains a first code block according to the first running instruction, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code;

[0072] 203. The terminal obtains a global table of the three-dimensional virtual scene;

[0073] 204. The terminal generates a first code block table of the first code block in the first sandbox according to the first code and the global table;

[0074] In this embodiment, steps 201 to 104 are similar to steps 101 to 104 in the aforementioned embodiment and are not described again here.

[0075] 205. The terminal sends information of the first code in the first code block table to a code sharing area in the three-dimensional virtual scene;

[0076] The terminal can send the information of the first code in the first code block table to the code sharing area in the three-dimensional virtual scene for other code blocks to call. The code sharing area is used to store the code in the code block before compilation and execution.

[0077] 206. The terminal compiles and executes the first code in the first code block table through the first sandbox;

[0078] In this embodiment, step 206 is similar to step 105 in the aforementioned embodiment and will not be described in detail here.

[0079] 207. The terminal receives a second running instruction, where the second running instruction carries a unique identifier of the second code block in the three-dimensional virtual scene;

[0080] In actual applications, the user can send the second operation instruction to the terminal in a variety of ways, such as inputting the second operation instruction to the terminal through an input device that is wirelessly or wiredly connected to the terminal, sending the second operation instruction to the terminal through a host that is data-connected to the terminal, etc. The specific method is not limited here. The second operation instruction carries a unique identifier of the second code block in the three-dimensional virtual scene.

[0081] 208. The terminal obtains a second code block according to the second running instruction, where the second code block includes a second code editing page and a second sandbox;

[0082] Because the second run instruction carries the unique identifier of the second code block in the three-dimensional virtual scene, the terminal can obtain the second code block in the three-dimensional virtual scene according to the unique identifier. The second code block belongs to a code block, which is a block included in the three-dimensional virtual scene, and the code block includes a code editing page and a sandbox. The second code block includes a second code editing page and a second sandbox, and the second code editing page stores the second code, and the second code includes a target code segment for calling the first code.

[0083] 209. The terminal obtains a global table of the three-dimensional virtual scene;

[0084] If the terminal wants to run the second code in the second code block, it may also need the global variables and global functions of the three-dimensional virtual scene, and the global variables and global functions of the three-dimensional virtual scene are all stored in the global table. Therefore, the terminal will obtain the global table.

[0085] 210. The terminal generates a second code block table of the second code block in the second sandbox according to the second code and the global table;

[0086] After acquiring the global table of the three-dimensional virtual scene, the terminal may generate a second code block table for the second code block in the second sandbox, where the second code block table includes information of the global table and information of the second code.

[0087] 211. The terminal compiles and executes the second code in the second code block table through the second sandbox;

[0088] After the terminal generates the second code block table in the second sandbox, the terminal can compile the second code block table in the second sandbox. If there is no compilation error, the second code in the second code block table can be executed continuously, wherein the first code in the code sharing area is called when the target code segment is compiled. If there is a compilation error, a pop-up window error report, an error report file can be generated, and an error report prompt (such as a prompt tone or vibration, etc.) can be issued to prompt the user that the compilation error needs to be modified.

[0089] In this embodiment, it is achieved that when the first code block is running, the second code block can call the first code of the first code block.

[0090] 212. The terminal receives an editing instruction, where the editing instruction carries information of a target character string;

[0091] In actual applications, the user can send the editing instruction to the terminal in various ways, such as inputting the editing instruction to the terminal through an input device connected to the terminal wirelessly or wired, sending the editing instruction to the terminal through a host connected to the terminal data, etc. The specific method is not limited here. The editing instruction includes information of the target string.

[0092] 213. The terminal inputs the target character string on the second code editing page according to the editing instruction;

[0093] After receiving the editing instruction, the terminal first extracts the target string from the editing instruction, and then inputs the target string into the second code editing page. It should be noted that the position of the target string can be determined by the cursor position displayed by the terminal, or the position information of the target string can be set in the editing instruction, which is not limited here.

[0094] 214. The terminal uses the target character string as a search keyword to traverse and search the second code block table and the code sharing area;

[0095] After copying the target string to the second code editing page, the terminal can use the target string as a search keyword to search the second code block table and the code sharing area to find a variable or function that matches the target string.

[0096] 215. The terminal determines whether at least one search result is obtained. If so, step 216 is executed; if not, the process ends.

[0097] After the terminal has completed the search operation, it can make a determination. If one or more search results are found, that is, if the terminal determines that there are variables or functions that match the target string, step 216 can be executed; otherwise, the terminal ends the process.

[0098] 216. The terminal determines at least one search result as a matching code.

[0099] After determining that there is a variable or function that matches the target character string, the terminal may use all search results obtained from the search as matching codes.

[0100] 217. The terminal displays the matching code on the second code editing page.

[0101] If the terminal determines the matching code of the target string, the matching code can be displayed on the code editing page to prompt the user with the relevant code. Furthermore, the user can select any one of the displayed matching codes to add to the second code editing page, and the relevant matching code can be added to the second code editing page without entering all the content. It should be noted that the terminal presets the display number of matching codes. If the number of matching codes obtained exceeds the display number, the terminal will only display a part of the matching codes, and the remaining matching codes can be displayed by scrolling, turning pages, etc.

[0102] In this embodiment, the user only needs to enter the target string in the second code editing page to browse the matching code of the target string, which is very convenient.

[0103] See also Figure 3 , Figure 3 This is a flow chart of another embodiment of the code running method provided by the present application, and the code running method includes:

[0104] 301. A terminal receives a first running instruction, where the first running instruction carries a unique identifier of a first code block in a three-dimensional virtual scene;

[0105] 302. The terminal obtains a first code block according to the first running instruction, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code;

[0106] 303. The terminal obtains a global table of the three-dimensional virtual scene;

[0107] In this embodiment, steps 301 to 303 are similar to steps 101 to 103 in the aforementioned embodiment and are not described again here.

[0108] 304. The terminal copies the global table and the first code to the first sandbox;

[0109] After acquiring the global table and the first code, the terminal may copy the first code and the global table to the first sandbox respectively.

[0110] 305. The terminal adds the copied first code to the copied global table to generate a first code block table;

[0111] After copying the first code and the global table to the first sandbox, the terminal can add the copied first code to the copied global table to generate a first code block table. In this way, the first code block table includes the contents of the global table and the first code at the same time. When executing the first code block table, there is no need to call the global table, which is beneficial to improving execution efficiency.

[0112] 306. The terminal sends information of the first code in the first code block table to a code sharing area in the three-dimensional virtual scene;

[0113] 307. The terminal compiles and executes the first code in the first code block table through the first sandbox;

[0114] In this implementation, steps 306 to 307 are similar to steps 205 to 206 in the aforementioned embodiment and are not described again here.

[0115] 308. The terminal stops the operation of the first sandbox;

[0116] When the terminal runs the first code block normally to the end, or the terminal receives a command to stop the running of the first code block, or an unexpected interruption occurs during the running of the first code block by the terminal, the terminal will stop the running of the first sandbox.

[0117] 309. The terminal deletes the first code in the code sharing area.

[0118] Once the terminal stops the operation of the first sandbox, the terminal will also delete the code sent by the first sandbox to the code sharing area, that is, the first code, so that other code blocks can no longer call the first code.

[0119] In this embodiment, after the first code block stops running, the first code in the code sharing area is deleted, which is beneficial to improving security.

[0120] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an embodiment of a code running device provided by the present application, and the code running device includes:

[0121] The receiving unit 401 is used to receive a first running instruction, where the first running instruction carries a unique identifier of the first code block in the three-dimensional virtual scene;

[0122] A first acquisition unit 402 is used to acquire a first code block according to a first running instruction, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code;

[0123] A second acquisition unit 403 is used to acquire a global table of the three-dimensional virtual scene, wherein the global table stores information of a global code of the three-dimensional virtual scene;

[0124] A generating unit 404 is configured to generate a first code block table for a first code block in a first sandbox according to the first code and the global table, wherein the first code block table includes information of the global table and information of the first code;

[0125] The first running unit 405 is configured to compile and execute the first code in the first code block table through the first sandbox.

[0126] In this embodiment, after receiving the first running instruction, the first acquisition unit 402 can acquire the first code block to be run in the three-dimensional virtual scene according to the first running instruction, and then the second acquisition unit 403 acquires the global table of the three-dimensional virtual scene, and the generation unit 404 generates the first code block table in the first sandbox of the first code block according to the global table and the first code, and finally the first running unit 405 compiles and executes the first code in the first code block table in the first sandbox. Since the first code in the first code block table is compiled and executed, the first code in the first code block table is locked, so that the user can modify the first code in the first code editing machine page while the first code in the first code block table is in the running stage, which improves the efficiency of user code modification and improves the user experience.

[0127] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an embodiment of a code running device provided by the present application, and the code running device includes:

[0128] The receiving unit 501 is used to receive a first running instruction, where the first running instruction carries a unique identifier of a first code block in a three-dimensional virtual scene;

[0129] A first acquisition unit 502 is used to acquire a first code block according to a first running instruction, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code;

[0130] A second acquisition unit 503 is used to acquire a global table of the three-dimensional virtual scene, wherein the global table stores information of a global code of the three-dimensional virtual scene;

[0131] A generating unit 504 is configured to generate a first code block table for the first code block in the first sandbox according to the first code and the global table, wherein the first code block table includes information of the global table and information of the first code;

[0132] The first running unit 505 is configured to compile and execute the first code in the first code block table through the first sandbox.

[0133] In this embodiment, the code execution device may further include a sending unit 506 , a second execution unit 507 , an editing unit 508 and a stopping unit 509 .

[0134] The sending unit 506 is used to send the information of the first code in the first code block table to the code sharing area in the three-dimensional virtual scene, where the code sharing area is used to store the code in the code block before it is compiled and executed.

[0135] The second operation unit 507 is used for:

[0136] receiving a second running instruction, wherein the second running instruction carries a unique identifier of the second code block in the three-dimensional virtual scene;

[0137] According to the second running instruction, a second code block is obtained, wherein the second code block includes a second code editing page and a second sandbox, the second code editing page stores a second code, and the second code includes a target code segment, and the target code segment is used to call the first code;

[0138] Obtaining a global table of a three-dimensional virtual scene;

[0139] According to the second code and the global table, generating a second code block table for the second code block in the second sandbox, wherein the second code block table includes information of the global table and information of the second code;

[0140] The second code in the second code block table is compiled and executed through the second sandbox, wherein the first code in the code sharing area is called when the target code segment is compiled.

[0141] The editing unit 508 includes a receiving module 5081 , an input module 5082 , a determination module 5083 and a display module 5084 .

[0142] The receiving module 5081 is used to receive an editing instruction, wherein the editing instruction carries information of a target character string;

[0143] The input module 5082 is used to input a target character string in the second code editing page according to the editing instruction.

[0144] The judgment module 5083 is used to:

[0145] Using the target string as a search keyword, traversing and searching the second code block table and the code sharing area;

[0146] Determine whether at least one search result is obtained;

[0147] If so, at least one search result is determined to be a matching code.

[0148] The display module 5084 is used to display the matching code on the second code editing page when the judgment module 5083 determines that there is a matching code matching the target character string.

[0149] The stopping unit 509 is used for:

[0150] Stop the operation of the first sandbox;

[0151] Delete the first code in the code sharing area.

[0152] In this embodiment, the generating unit 504 may be specifically used for:

[0153] Copy the global table and the first code to the first sandbox;

[0154] The copied first code is added to the copied global table to generate a first code block table.

[0155] In this embodiment, the functions of each unit and module are the same as those described above. Figures 2 to 3 The steps in the illustrated embodiments correspond to each other and will not be described again here.

[0156] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of an embodiment of a code running device provided by the present application, and the code running device includes:

[0157] Processor 601, memory 602, input and output unit 603 and bus 604;

[0158] The processor 601 is connected to the memory 602, the input and output unit 603 and the bus 604;

[0159] The memory 602 stores a program, and the processor 601 calls the program to execute the following steps: Figures 1 to 3 The code in the illustrated embodiment executes the steps in the method.

[0160] The present application also relates to a computer-readable storage medium, on which a program is stored, wherein when the program is run on a computer, the computer executes Figures 1 to 3 The code in the illustrated embodiment executes the steps in the method.

[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0162] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0164] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0165] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk, etc. Various media that can store program codes.

Claims

1. A code running method, characterized in that: The method comprises: receiving a first running instruction, wherein the first running instruction carries a unique identifier of the first code block in the three-dimensional virtual scene; According to the first running instruction, the first code block is acquired, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code; Acquire a global table of the three-dimensional virtual scene, wherein the global table stores information of a global code of the three-dimensional virtual scene; Generate a first code block table of the first code block in the first sandbox according to the first code and the global table, wherein the first code block table includes information of the global table and information of the first code; Compile and execute the first code in the first code block table through the first sandbox; After generating a first code block table of the first code block in the first sandbox according to the first code and the global table, and before compiling and executing the first code in the first code block table by the first sandbox, the method further includes: Sending information of the first code in the first code block table to a code sharing area in the three-dimensional virtual scene, wherein the code sharing area is used to store the code in the code block before it is compiled and executed; After sending the information of the first code in the first code block table to the code sharing area in the three-dimensional virtual scene, the method further includes: receiving a second running instruction, wherein the second running instruction carries a unique identifier of a second code block in the three-dimensional virtual scene; According to the second running instruction, the second code block is obtained, wherein the second code block includes a second code editing page and a second sandbox, the second code editing page stores a second code, and the second code includes a target code segment, and the target code segment is used to call the first code; Obtaining a global table of the three-dimensional virtual scene; Generate a second code block table of the second code block in the second sandbox according to the second code and the global table, wherein the second code block table includes information of the global table and information of the second code; The second code in the second code block table is compiled and executed by the second sandbox, wherein the first code in the code sharing area is called when the target code segment is compiled.

2. The code running method according to claim 1, characterized in that: After the second code in the second code block table is compiled and executed by the second sandbox, the method further includes: receiving an editing instruction, wherein the editing instruction carries information of a target character string; According to the editing instruction, input the target character string in the second code editing page; Determine whether there is a matching code matching the target character string in the second code block table and the code sharing area; If so, the matching code is displayed on the second code editing page.

3. The code running method according to claim 2, characterized in that: The determining whether there is a matching code matching the target character string in the second code block table and the code sharing area comprises: Using the target character string as a search keyword, traversing and searching the second code block table and the code sharing area; Determine whether at least one search result is obtained; If so, the at least one search result is determined to be a matching code.

4. The code running method according to claim 1, characterized in that: After the first code in the first code block table is compiled and executed by the first sandbox, the method further includes: Stop the operation of the first sandbox; The first code in the code sharing area is deleted.

5. The code running method according to any one of claims 1 to 4, characterized in that: Generating a first code block table of the first code block in the first sandbox according to the first code and the global table includes: copying the global table and the first code to the first sandbox; The copied first code is added to the copied global table to generate a first code block table.

6. A code running device, characterized in that: The device comprises: A receiving unit, configured to receive a first running instruction, wherein the first running instruction carries a unique identifier of the first code block in the three-dimensional virtual scene; A first acquisition unit is used to acquire the first code block according to the first running instruction, where the first code block includes a first code editing page and a first sandbox, and the first code editing page stores a first code; A second acquisition unit, configured to acquire a global table of the three-dimensional virtual scene, wherein the global table stores information of a global code of the three-dimensional virtual scene; a generating unit, configured to generate a first code block table of the first code block in the first sandbox according to the first code and the global table, wherein the first code block table includes information of the global table and information of the first code; A first running unit, configured to compile and execute a first code in the first code block table through the first sandbox; The code execution device also includes: A sending unit, used to send information of the first code in the first code block table to a code sharing area in the three-dimensional virtual scene, wherein the code sharing area is used to store the code in the code block before it is compiled and executed; The code execution device further includes a second execution unit, wherein the second execution unit is configured to: receiving a second running instruction, wherein the second running instruction carries a unique identifier of a second code block in the three-dimensional virtual scene; According to the second running instruction, the second code block is obtained, wherein the second code block includes a second code editing page and a second sandbox, the second code editing page stores a second code, and the second code includes a target code segment, and the target code segment is used to call the first code; Obtaining a global table of the three-dimensional virtual scene; Generate a second code block table of the second code block in the second sandbox according to the second code and the global table, wherein the second code block table includes information of the global table and information of the second code; The second code in the second code block table is compiled and executed by the second sandbox, wherein the first code in the code sharing area is called when the target code segment is compiled.

7. A code running device, characterized in that: The device comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the code running method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a program stored thereon, wherein when the program is executed on a computer, the computer is caused to execute the code running method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • User code operation method and device, electronic equipment and storage medium

    CN114117409A