Want to know the advantages and disadvantages of some commonly used script engines for ease of use in subsequent projects

Source: Internet
Author: User
Tags blizzard

1 chaiscript. This was found yesterday and only compiled one demo.Program, It seems that the compilation speed is a little slow, and the help documentation is not very comprehensive, but it is not used in detail in general, so it is difficult to comment;

2 anglescript, http://www.angelcode.com, this document seems OK, but it is not used in detail;

3 Lua, http://www.lua.org/, this seems to be used in the game development industry more, with more popular on the prosperous, the more stable, it is said that blizzard is also using it, in addition, the combination with C ++ is good, and the script syntax is similar to C. You can focus on it. Here is an introduction to the script, so I will post it several times:

 Lua is a small scripting language. The author is Brazilian. The language is designed to be embedded into an application and provide flexible scalability and customization for the application. Its home page is www.lua.org. Lua's most famous application is in Blizzard's online game wow. The Lua script can be easily called by C/C ++  Code  or call C/C ++ functions in turn, this makes Lua widely used in applications. Not only as an extension script, but also as a common configuration file, instead of XML, INI and other file formats, and easier to understand and maintain. Lua is compiled by standard C. The code is concise and elegant, and can be compiled and run on almost all operating systems and platforms. A complete Lua interpreter is only 200 K. Currently, Lua is the fastest in all script engines. All of these determine that Lua is the best choice for embedded scripts. Lua has a JIT project at the same time to provide real-time compilation functions on a specific platform, which will bring Lua better performance. Please visit http://luajit.org/to solve this project. Unlike scripts such as Python, Lua does not provide a powerful library, which is determined by its positioning. Therefore, Lua is not suitable for developing independent applications. However, Lua still has basic functions such as mathematical operations and string processing. The latest version of Lua is 5.1. 1. The goal of Lua is to become a language that is easy to embed into other languages. Most programmers also think that it does. Many applications use Lua as their embedded scripting language to achieve configurability and scalability. This includes World of Warcraft and the gate of Bode. 2 features Lua has the following features: the lightweight Lua official version only includes a streamlined core and the most basic library. This makes Lua small in size and fast in startup, so it is suitable for embedding in other programs. Scalable Lua is not like many other "Big and comprehensive" languages, including many functions, such as network communication and graphic interfaces. However, Lua can be easily extended: these functions are provided by the host language (usually C or C ++), and Lua can use them, just as they are originally built in. Other features Lua has other features: it also supports process-oriented and object-oriented programming, automatic memory management, and a series of data structures, including arrays, linked lists, sets, dictionaries, and HASH lists; built-in Regular Expression matching in languages; closure; functions can also be seen as values; multi-thread support; and so on. 
 
 
4 How to Integrate Lua scripts (luaplus) in C ++: http://win.chinaunix.net/bbs/thread-113954-1-1.html
 
5 forcal, there is a scripting language, http://www.forcal.net/, this seems to be oriented to high-performance numeric software development, not what I want
 
6. How to Use Lua in VC

1. Lua static library
compiling to a static library is simple. Someone has already written it. The excerpt is as follows:
Lua includes core lib and standard Lib, for details, refer to the document. For the sake of simplicity, we put it in a Lib. We need to create a static library project and then add its source file to the project, contains the following file
core Lib: lapi. c lcode. c ldebug. c. c ldump. c lfunc. c lgc. c llex. c lmem. c lobject. c lopcodes. c LP *** R. c lstate. c lstring. c ltable. c ltests. c ltm. c lundump. c LVM. c lzio. c
standard Lib: lauxlib. c lbaselib. c ldblib. c liolib. c lmathlib. c ltablib. c
lst Rlib. c loadlib. c
and set the output path to lib
2. Lua dynamic library
compile the dynamic library. First, modify Lua. h header file. As follows:
/* mark for all API functions */
// # ifndef lua_api
// # define lua_api extern
// # endif
# ifdef lua502_exports // depends on your project
# define lua_api _ declspec (dllexport)
# else
# define lua_api _ declspec (dllimport)
# endif
then create a Win32 DLL using VC, including *. H and *. c file (refer to 1). compile it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.