CN102819579A - Lua script file management method by using package system - Google Patents

Lua script file management method by using package system Download PDF

Info

Publication number
CN102819579A
CN102819579A CN2012102590678A CN201210259067A CN102819579A CN 102819579 A CN102819579 A CN 102819579A CN 2012102590678 A CN2012102590678 A CN 2012102590678A CN 201210259067 A CN201210259067 A CN 201210259067A CN 102819579 A CN102819579 A CN 102819579A
Authority
CN
China
Prior art keywords
bag
script file
name
search
lua script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012102590678A
Other languages
Chinese (zh)
Other versions
CN102819579B (en
Inventor
王斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Xishanju Interactive Entertainment Technology Co Ltd
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Zhuhai Kingsoft Online Game Technology Co Ltd
Chengdu Xishanju Interactive Entertainment Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Kingsoft Online Game Technology Co Ltd, Chengdu Xishanju Interactive Entertainment Technology Co Ltd filed Critical Zhuhai Kingsoft Online Game Technology Co Ltd
Priority to CN201210259067.8A priority Critical patent/CN102819579B/en
Publication of CN102819579A publication Critical patent/CN102819579A/en
Application granted granted Critical
Publication of CN102819579B publication Critical patent/CN102819579B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a Lua script file management method by using a package system. In the method, each Lua script file corresponds to a package and each package is allocated with an unique identification (ID) and provided with a parents table for storing IDs of packages contained in the current package and a name table for storing names of objects cited by the current package; and the packages are further configured to mutual independence among the packages and one-way connections called 'include' are created among the packages through a specific application program interface (API). Compared with the prior art, the method provided by the invention has the advantages that the memory use efficiency and the execution efficiency are guaranteed, objects with the same names in different files cannot conflict mutually, different Lua script files can be communicated by data sharing through a specific mechanism, and the compatibility is still remained in grammar level.

Description

A kind of lua script file management method that adopts machine contracting system
Technical field
The present invention relates to a kind of script, especially a kind of lua script file management method that adopts machine contracting system.
Background technology
Server end and client in online game need be applied to the lua script technology usually.These lua codes are distributed in a large amount of lua scripts usually, so these lua scripts are managed with regard to mechanism of needs.This mechanism need satisfy following demand:
1. can manage a plurality of lua scripts, these lua scripts all must be carried in the same lua virtual machine so that carry out communication;
2. not only need be able to communicate with one another but also must keep certain independence between the different lua scripts.
Lua itself provides certain mechanism to manage a plurality of lua script files, but it has the comparison critical limitations to cause and can not directly in game products, directly use:
Though 1.lua module (module) mechanism is provided self, can guarantee that a script file loads once, the conflict each other of the object of the same name of different files;
2. the tangible incidence relation of neither one between the different files is unfavorable for the tissue that programmed logic concerns.
Summary of the invention
For overcoming above-described defective, the present invention has realized a kind of management method of lua virtual machine, and existing lua virtual machine is transformed, and can manage a large amount of lua script files flexible and efficiently.
The present invention has proposed a kind of lua script file management method that adopts machine contracting system for this reason; It comprises the bag as the container of object name in the program; Each different lua script file is corresponding to a bag, each exclusive sign (ID) that has been responsible for assigning, and the father (parents) that each Bao Jun has an ID that is used to preserve the bag that current pack comprises shows and is used to preserve the name table of the name of the object that current pack refers to; Said encapsulating further is set to: separate between the bag; And set up between bag through certain applications program interface (API) and to be called the vertical linkage that comprises (include), a bag can be comprised by a plurality of bag, also can comprise a plurality of bags; But a bag only knows and oneself comprised those bags, and do not know ownly to be comprised by those bags;
Said method also includes overall situation bag, and it does not need to be configured to involved promptly visible for other all bags automatically;
Said method also includes the bag table of unified lua script file name to bag, is used for bag is retrieved;
Said method has also defined following script file and has loaded flow process:
1) search the script file that need to load whether in the bag table, then jump to 6 in this way), as otherwise continue next step;
2) newly-built bag, and distribute ID to add the bag table;
3) whether inspection includes other bag, as otherwise jump to 6), then continue next step in this way;
4) load involved bag;
5) parents with involved bag adding current pack shows;
6) loading scripts file.
As a kind of improvement of above technical scheme, said method has also been introduced overall bag, and the said overall situation encapsulates and is configured to need do not comprised by other bag promptly is that other all bags are visible automatically.
As a kind of improvement of above technical scheme, said method comprises following filename finding step:
1) search in the name table in current pack earlier, find and then finish to search, the person does not continue next step;
2) in overall situation bag, search, find and then finish to search, the person does not continue next step;
The name table of the bag of 3) successively parents table being quoted is searched.
As a kind of improvement of above technical scheme, wherein search and adopt the traversal rule of dark search earlier.
With respect to prior art, lua script management method proposed by the invention has the following advantages:
1.lua script file all is carried in the same lua virtual machine, has guaranteed the internal memory service efficiency and has carried out efficient;
2. different lua script files is separate, and the object of the same name in the different files can not conflict mutually;
3. different lua script files can carry out communication through the specific mechanism shared data;
4. though the lua virtual machine is transformed, is still kept compatible in the grammer aspect.
Description of drawings
Below in conjunction with accompanying drawing and embodiment the present invention is further specified.
Fig. 1 is the synoptic diagram of the mutual relationship of wrapping among the present invention;
The synoptic diagram that Fig. 2 forms for the structure of wrapping among the present invention;
Fig. 3 loads the synoptic diagram of flow process for script file among the present invention.
Embodiment
Technical scheme of the present invention utilizes a kind of machine contracting system to manage each lua script file, and each different lua script file is corresponding to a bag, and wherein bag is the container of object name in a kind of program, and object then is the entity of data structure or function in the program.Each bag identifies (ID) with a numeral, in a preferred embodiment, bag be designated one more than or equal to 0 integer, promptly begin to increase progressively from numeral 1.
Each bag all has oneself independently name space, the i.e. mapping table of object name and object.The present invention also includes the bag table of a unified filename to bag, and it is a kind of mapping table of key-value type, is used for the mapping of script file name to corresponding bag, is used in the present invention bag is retrieved.
In the present invention, encapsulate be configured to separate, but can through certain applications program interface (API) the bag between set up vertical linkage, this vertical linkage is called and comprises (include).That is to say that include is the address of a kind of vertical linkage between bag and the bag, also is to set up the used API name of this connection.Specifically, (include) bag A if bag B comprises, the object that then wraps A is visible for bag B; But can not set up backward linkage simultaneously,, then not allow to wrap A and comprise B if promptly bag B has comprised bag A.A bag can be comprised by a plurality of bag, also can comprise a plurality of bags.But a bag only knows and oneself comprised those bags, and do not know ownly to be comprised by those bags.Specifically as shown in Figure 1.
In addition, the present invention also includes a special overall situation bag, and Digital ID is 0, need not comprised promptly visible for other all bags automatically by other bag.
Specifically, all have during each wraps two kinds of key data structure arranged:
1. father (parents) table: a kind of by the bag set table of using, the member is by the ID of the bag of the Include of current pack institute, is used to preserve the ID of the bag that current pack comprises in the present invention;
2. name table: a kind of mapping table of key-value type, be used for of the mapping of object name to object, be used to preserve the name of the object that current pack refers in the present invention.
Its concrete structure is as shown in Figure 2.Fig. 3 has shown that its step comprises according to script file loading flow process of the present invention:
1) search the script file that need to load whether in the bag table, then jump to 6 in this way), as otherwise continue next step;
2) newly-built bag, and distribute ID to add the bag table;
3) whether inspection includes other bag, as otherwise jump to 6), then continue next step in this way;
4) load involved bag;
5) parents with involved bag adding current pack shows;
6) loading scripts file.
Lua need obtain corresponding object according to name when carrying out, this process is called as name and searches.In the present invention, searching through following steps of lua script file name realized in the present invention:
1. in the name table of current pack, search earlier, find and then finish to search;
2. in overall situation bag, search, find and then finish to search;
3. the name table of the bag of successively parents table being quoted is searched, and finds and then finishes to search.
The traversal rule of wherein searching is dark search earlier, or is called depth-first search.
Like this, with respect to prior art, lua script management method proposed by the invention has the following advantages:
1.lua script file all is carried in the same lua virtual machine, has guaranteed the internal memory service efficiency and has carried out efficient;
2. different lua script files is separate, and the object of the same name in the different files can not conflict mutually;
3. different lua script files can carry out communication through the specific mechanism shared data;
4. though the lua virtual machine is transformed, is still kept compatible in the grammer aspect.
Certainly, the present invention is except above-mentioned embodiment, and other equivalent technical solutions also should be within its protection domain.

Claims (3)

1. lua script file management method that adopts machine contracting system; It is characterized in that: comprise bag as the container of object name in the program; Each different lua script file is corresponding to a bag, each exclusive sign (ID) that has been responsible for assigning, and the father (parents) that each Bao Jun has an ID that is used to preserve the bag that current pack comprises shows and is used to preserve the name table of the name of the object that current pack refers to; Said encapsulating further is set to: separate between the bag; And set up between bag through certain applications program interface (API) and to be called the vertical linkage that comprises (include), a bag can be comprised by a plurality of bag, also can comprise a plurality of bags; But a bag only knows and oneself comprised those bags, and do not know ownly to be comprised by those bags;
Said method also includes overall situation bag, and it does not need to be configured to involved promptly visible for other all bags automatically;
Said method also includes the bag table of unified lua script file name to bag, is used for bag is retrieved;
Said method has also defined following script file and has loaded process step:
1) search the script file that need to load whether in the bag table according to name, then jump to step 6) in this way, as otherwise continue next step;
2) newly-built bag, and distribute ID to add the bag table;
3) whether inspection includes other bag, as otherwise jump to step 6), then continue next step in this way;
4) load involved bag;
5) parents with involved bag adding current pack shows;
6) loading scripts file.
2. a kind of lua script file management method according to claim 1 is characterized in that: comprise following lua script file name finding step:
1) search in the name table in current pack earlier, find and then finish to search, the person does not continue next step;
2) in overall situation bag, search, find and then finish to search, the person does not continue next step;
The name table of the bag of 3) successively parents table being quoted is searched.
3. a kind of lua script file management method according to claim 3 is characterized in that: search and adopt the traversal rule of dark search earlier.
CN201210259067.8A 2012-07-25 2012-07-25 Lua script file management method by using package system Active CN102819579B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210259067.8A CN102819579B (en) 2012-07-25 2012-07-25 Lua script file management method by using package system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210259067.8A CN102819579B (en) 2012-07-25 2012-07-25 Lua script file management method by using package system

Publications (2)

Publication Number Publication Date
CN102819579A true CN102819579A (en) 2012-12-12
CN102819579B CN102819579B (en) 2014-12-10

Family

ID=47303690

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210259067.8A Active CN102819579B (en) 2012-07-25 2012-07-25 Lua script file management method by using package system

Country Status (1)

Country Link
CN (1) CN102819579B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106647337A (en) * 2017-02-27 2017-05-10 南京国电南自轨道交通工程有限公司 Electrical equipment remote control locking characteristic simulation method based on LUA scripts
CN107273138A (en) * 2017-07-04 2017-10-20 杭州铜板街互联网金融信息服务有限公司 Decoupling method and system based on interaction between Android business modules

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101196812A (en) * 2007-12-14 2008-06-11 上海科泰世纪科技有限公司 Method for script language calling multiple output parameter interface by component software system
US20110209137A1 (en) * 2008-10-27 2011-08-25 Lars-Ake Berg Label printer api using program scripting language

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101196812A (en) * 2007-12-14 2008-06-11 上海科泰世纪科技有限公司 Method for script language calling multiple output parameter interface by component software system
US20110209137A1 (en) * 2008-10-27 2011-08-25 Lars-Ake Berg Label printer api using program scripting language

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106647337A (en) * 2017-02-27 2017-05-10 南京国电南自轨道交通工程有限公司 Electrical equipment remote control locking characteristic simulation method based on LUA scripts
CN106647337B (en) * 2017-02-27 2019-11-05 南京国电南自轨道交通工程有限公司 Electrical equipment romote controlled locking characteristic Simulation method based on LUA script
CN107273138A (en) * 2017-07-04 2017-10-20 杭州铜板街互联网金融信息服务有限公司 Decoupling method and system based on interaction between Android business modules

Also Published As

Publication number Publication date
CN102819579B (en) 2014-12-10

Similar Documents

Publication Publication Date Title
CN104424002B (en) A kind of dynamic load assembly method and system based on Plugin Mechanism
CN108234670B (en) Zookeeper and netty-based distributed remote calling method
CN115291964B (en) Mechanism for reducing start-up delay of server-less function
US9183032B2 (en) Method and system for migration of multi-tier virtual application across different clouds hypervisor platforms
JP2020536321A5 (en)
CN109144478B (en) Component frame system and method of using the same
WO2015149600A1 (en) Virtual network service deployment method and device
CN108345511B (en) Application data checking method and device and electronic equipment
CN103259936B (en) Operating system upgrade method for mobile terminal and operating system upgrade device of operating system upgrade method
CN110109649B (en) Container control method, device and container system for Web service
US9378034B2 (en) Dynamic bytecode modification of classes and class hierarchies
CN111221618B (en) Deployment method and device for containerized virtual network function
CN110780858A (en) Software layering architecture based on embedded operating system
CN104699537A (en) Program control method, activity module scheduling method and corresponding devices thereof
CN102073525A (en) Method and device for dynamically upgrading Web service system based on Java platform
CN111142971A (en) Cloud platform application readiness checking method suitable for traditional application clouding
CN106844678A (en) A kind of exchange method of Mybatis data sources and connection pool
CN110704035A (en) Plug-in type software architecture system and implementation method thereof
US20110154379A1 (en) System and method for providing transaction monitor integration with service component architecture (sca) runtime
CN102819579B (en) Lua script file management method by using package system
CN111324395B (en) Calling method, device and computer readable storage medium
CN106502757A (en) A kind of plug-in management method and device
CN116954831A (en) Method and system for generating container mirror image package based on assembly file
WO2018068655A1 (en) License management method and system
CN103336798A (en) Virtualized data access system and method of embedded network device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 519000 Room 102, 202, 302 and 402, No. 325, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province, Room 102 and 202, No. 327 and Room 302, No. 329

Patentee after: Zhuhai Jinshan Digital Network Technology Co.,Ltd.

Patentee after: CHENGDU XISHANJU INTERACTIVE ENTERTAINMENT TECHNOLOGY Co.,Ltd.

Address before: 519000 Jinshan software building, 8 Lanshan lane, Jida Jingshan Hill Road, Zhuhai, Guangdong

Patentee before: ZHUHAI KINGSOFT ONLINE GAME TECHNOLOGY Co.,Ltd.

Patentee before: CHENGDU XISHANJU INTERACTIVE ENTERTAINMENT TECHNOLOGY Co.,Ltd.