briage free如何进入free游泳部第二季关卡

lua-users wiki: Binding Code To Lua
Lua can be embedded and extended with code or applications written in other languages.
Code and values in another language can be exposed to Lua and vice-versa.
The following lists low and high level solutions for binding between Lua and other languages.
The most direct method to bind to Lua is with the Lua C API.
The C API consists of two parts: the basic API (lua.h) provides the primitive functions for all interactions between C and Lua, while the auxiliary library (lauxlib.h) provides higher-level functions for some common tasks.
(5.1) describes Lua's native C API for calling Lua from C and vice-versa.
See also Lua book . Or read about the C API online in the 1st edition of PIL:
Enabling API checking
By default, the Lua C API does almost no sanity checking of arguments passed to it. Passing incorrect stack indexes, for example, can result in segfaults or random data corruption.
You should always enable API checking in any debug build. You can do this by compiling with the option -DLUA_USE_APICHECK. luaconf.h uses this C macro to define luai_apicheck to call assert() in various places (you can also edit this definition to do something possibly more useful).
Some examples of using the C API can be found by examining the source code of Lua's own standard libraries (src/*lib.c}.
For example, the math library (math.*) is implemented in the file src/lmathlib.c.
The basic form of this file is outlined below.
First we import various headers, including the C API (lua.h) and the axillary library (lauxlib.h):
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
Then various Lua functions implemented in C are defined.
These all have the same signature, and arguments are passed via Lua's own stack.
For example, the sin function is defined as follows. luaL_check_number() is used to check the correct type of the sin function argument. lua_pushnumber() is used to return the sine calculated. Note, the return value of the math_sin() function is the number of values returned (lua functions can return many values).
static int math_sin (lua_State *L) {
lua_pushnumber(L, sin(luaL_checknumber(L, 1)));
These functions are registered into Lua by building a table of function pointers and names and then calling luaL_register().
Constants pi and huge are set separately.
This registration code is placed in a function named luaopen_math(), which can be called statically (e.g. from linit.c) or dynamically (via Lua's shared library loading mechanism via require).
static const luaL_Reg mathlib[] = {
math_abs},
math_cos},
math_sin},
... etc...rest of table not included, but make sure you finish of with:
{NULL, NULL}
** Open math library
LUALIB_API int luaopen_math (lua_State *L) {
luaL_register(L, LUA_MATHLIBNAME, mathlib);
lua_pushnumber(L, PI);
lua_setfield(L, -2, "pi");
lua_pushnumber(L, HUGE_VAL);
lua_setfield(L, -2, "huge");
Binding C/C++ with Lua
(5.2) - Automatically wrap C functions and structs at runtime.
(5.1) - A C bindings generator written in Lua.
It turns C structs into objects.
(5.0) - a C API over the official Lua API.
(5.0) - A way to bind C functions and structures to Lua, and work with C pointers, arrays and functions in Lua. (uses x86 assembly)
C Foreign Function Interfaces (FFI)
(5.1) - a foreign function interface (FFI) for Lua. An
lets Lua code call C functions directly without having to write C "glue", so you can use Alien to write C extensions purely in Lua.
(Wraps libffi)
(5.1) - Use
from Lua to call C libraries
(DLLs, .so files) directly, like Microsoft's P/Invoke and Python's ctypes.
(Similar to Alien)
allows calling external C functions and using C data structures from Lua code. It parses plain C declarations and supports C99 plus some GCC/MSVC/C++ extensions.
(5.1) - an implementation of LuaJIT FFI for Lua.
(5.1) - Simple interface to TCC, a fast runtime C compiler by Fabrice Bellard, it allows a Lua script to compile C code and register it at runtime as Lua-callable C funcions.
Intentionally limited to avoid TCC's bug with multi-environments, that would be too tempting in Lua.
(5.1) - another, more complete, Lua binding for libtcc, which is the core library of the . It allows compiling and loading C code directly from Lua, includes the ability to load C modules directly from C source.
provides a similar approach, invoking other compilers out-of-process.
Various C++ or C++ template bindings have been developed to simplify the process in C++:
(5.0 & 5.1) - a C++ wrapper of the Lua API; handles class member functions.
(5.2) - a C++ wrapper of the Lua API. Uses TMP to make calling/passing functions, handling coroutines and filling tables easy and type-safe.
(5.2) - a C++11 easy to use and type safe wrapper of the Lua API.
(5.1) - A library that intends to make the coexistence of C++ and Lua more harmonious.
(5.2) - Simple bindings for Lua using C++11 supporting class and function registration, custom member functions, multiple return values, tables and more.
(5.1 & ) - a template-based binding of C++ classes and functions which uses the Boost library. The library seems to be abandoned by the , but some more or less actively maintained
exist, e.g.
(5.1 & 5.2) - lightweight, dependency-free, template-based library for exporting C++ classes/functions to Lua environments.
(5.2) - Simple Lua Binder, a cross platform, small, easy to integrate, template-based library. Very similar to Luabind or boost-python but SLB doesn't require boost or any other dependency.
(5.1) and (5.2) - clean, template-based method of binding a C++ class to Lua. See also
(5.1) - a template-based binding of C++ classes and functions which uses the Loki library.
(5.1) - a simple library that demonstrates Lua independent C++ interface to bind C++ classes and functions.
(5.1, 5.2 & 5.3 work2) - Cross platform template generator binding which has no dependencies.
(5.2) - Dead simple and intuitive C++11 bindings supporting class registration and functions.
(5.1) - a template-based binding of C++ classes and functions. (MSVC)
- emits functions at compile time via C++ templates and argument overloading
- Creates bindings to Lua by using Doxygen to parse C++ headers. Supports many advanced features (namespaces, type casting, natural public member read/write, template resolution, etc).
- 'namespace lua' binding of C/C++ functions, table-like usage, templated based (no boost)
- A single header library that provides type-safe and intuitive functions such as luaW_to&T& and luaW_push&T& for arbitrary types, to make managing C++ classes with Lua simple.
- Automatic lua binding-code generator. Fully-featured, fast compilation and execution speed, human-readable output codes, and no boost dependency.
- Lightweight C++ API for Lua. Lutok provides provides thin C++ wrappers around the Lua C API to ease the interaction between C++ and Lua. These wrappers make intensive use of RAII to prevent resource leakage, expose C++-friendly data types, report errors by means of exceptions and ensure that the Lua stack is always left untouched in the face of errors. The library also provides a small subset of miscellaneous utility functions built on top of the wrappers.
- Very lightweight library for creating Lua bindings. Boost is not a dependency.
(5.1, 5.2 & 5.3) - C++ library with no dependencies for creating Lua bindings.
(5.1, 5.2 & 5.3) - Pure C++11 API and binding for Lua (headers only), supports lua stack API, a higher level API that can refer lua object just like a C++ class object, and can also export C++ class and functions for lua script. The export binding supports custom C++ type, multiple return values, C++ shared pointer, in/out arguments, and can also make argument optional or with default value. The new version also comes with an optional Qt data type mapping (QString, QVariant, QByteArray, etc...).
(5.1 & 5.2) - C++11 template library (clang, gcc and VS 12) no boost.
Made to be really easy to use and as fast as possible. Lambda based bindings from Lua to C++.
- provides a few simple code fragments for helping Lua and C++ work together
- luagen++, a C++ header file to generate efficient sequences of Lua C API calls at compile-time via template metaprogramming techniques
- lua_load chunk reader for any C++ std::istream (function)
- One developer's attempt to find a good binding framework for use in a memory-constrained environment.
Calling Lua from C/C++
These frameworks and articles are one-way bindings: to call Lua functions from C/C++ passing arguments and getting return values.
(5.0) - from PiL uses a format string to call a global function with a variable number of arguments.
(5.1) - uses code snippets and printf/scanf like format strings to support many types and features.
(5.1) - uses code snippets along with C++ constructor overloads and templates, supports nearly all C++ types.
(5.1) - embeds a Lua interpreter in a C++ application, using an OO API. See also .
- example using the C API: the C program loads/runs a Lua script file, sets Lua variables and retrieves return value.
- another more advanced example using regular C API to run a Lua script file with arguments.
- explanation of how to get return values from lua_dostring.
- example to use the Luna binding (see above) to call Lua from C++.
Embedding Lua in C++
These frameworks are a little broader than the previous ones: they allow your C++ program full interaction with a Lua interpreter, but leave the task of extending Lua to other binding systems (SWIG, tolua++, and others).
: (pronounced "lua-ix") Lua interpreter for C++; call Lua functions and User Data (class) methods, use tables, create function sandboxes, use multiple return values, evaluate expressions and scripts, and more. The missing link for use of bindings like SWIG and tolua++.
Automatic binding generators
(5.2) - If there is a lot of information to bind then automating the process using a binding generator can help. toLua is one such tool. A package file is prepared, which is a cleaned up version of the C/C++ interface. Another advantage of this technique is that less work may be required between Lua versions if the Lua C API changes significantly.
(5.1) - an extended version of tolua, with some extra features oriented to c++. See also
(compiling tolua++ without SCons).
(5.0) - A simple, fast, and powerful binding library for the Lua scripting language. It takes the information from the compilers symbols and generates binding code directly from it. (MSVC)
(5.0/5.1) - Simplified Wrapper and Interface Generator, it can generate bindings between your C/C++ code and a variety of scripting languages (Python, Perl, Tcl/Tk, Ruby, ...), including Lua. A big advantage might be that *one* interface file, similar to that used in tolua/tolua++, is used for bindings to all languages supported by SWIG.
See also the SWIG docs pertaining to Lua .
- lua binding-code generator that supports features such as properties, inheritance (both from lua and c++), namespace, enum, type-checking, c++ exception handling, adopt-policy, g++ and MSVS, operator overloading, user-configurable custum string and number/enum types and so on. Fast compilation and execution speed (much faster than luabind and SWIG), human-readable output codes, no boost dependency.
- Uses Doxygen to parse C++ headers. Supports features such as properties, inheritance, type casting, Lua wrapping, enum, exception handling, operators, custom type binding, C++ template resolution, C++ callbacks with error handling, overloaded methods with runtime type resolution, etc. The generated code is optimized to be as fast as possible (return value optimization, inline objects, etc).
Proxy wrapper for DLL
Function information can be exported from dynamically linked libraries.
describes a method to call these functions from script (or RPC).
This functionality can be used from Lua .
Miscellaneous
(5.0) - A set of abstract classes to add script-interpreter support to your wxWidgets applications/libraries.
Other languages
(5.0) - Lua binding to Ada 95. (link broken)
(5.1) - Ada bindings to the Lua language (public domain) (link broken)
(5.2) - Ada bindings to the Lua Language with generic packages to ease binding of Ada types to Lua
Bash Shell
The luabash tool is a dynamically loadable module for the bash shell that provides a bridge between the bash shell and the lua scripting language. This enables complex embedded code segments to be replaced with efficient lua code and the speed of shell scripts to be increased without the drastic need to rewrite existing code.
- A open-source BASIC compiler that comes with the Lua headers and libraries.
(5.0.2) - a Purebasic library wrapping Lua 5.0.2. (deprecated)
(5.0) - PowerBASIC include & source for wrapping Lua (work in progress).
(5.1.2) - a
module wrapping Lua 5.1.2 (note: the link currently points into this wiki (which is usually a bad idea in this list) but this will change as soon as the package has its own web site)
(5.1) - Using Lua with OpenCOBOL 1.1
- Generated documentation from the OpenCOBOL interface source code
(5.1) - Lua bindings and high-level interfaces for the D programming language.
(5.1) - Lua bindings for the D programming language.
(5.1) - aims to enable seamless interoperability between Erlang and Lua.
(5.1) - an Erlang linked-in driver that allows embedding Lua into the Erlang VM.
(5.1) - Lua bindings for Erlang.
(5.3) - aims to enable seamless usage of Lua scripts for configuration of Fortran applications, uses the ISO-C-Binding.
- Interaction with Lua via the Fortran 2003 ISO-C-Binding.
(5.1) - Lua bindings for Go.
(5.1) - a reflection layer on top of golua API providing a simplified way to publish go functions to a Lua VM..
(5.1) - Scripting.Lua binding for Haskell.
(5.1) - allows scripts written in Lua to manipulate components developed in Java (JNI to native Lua) and vice-versa.
(5.2, 5.1) - another Java JNI &-& Lua bridge. Includes JSR 223 (Scripting for the Java Platform) provider.
- Java JNA &-& native Lua bridge.
(5.0, 5.1) - embedding Lua into National Instruments LabVIEW.
Objective-C
(5.1) - calling Lua from Objective-C and vice-versa (MacOS X Cocoa).
(5.1) - a LuaObjCBridge-based framework, makes it easy to setup and run Lua scripts.
(5.1) - spiritual successor to LuaObjCBridge/LuaCore, bridge between Lua & Obj-C, and uses Apple's BridgeSupport to fill in remaining non-ObjC areas (e.g. structs, C functions, inline functions) to access all APIs on the platform. Also includes a command line tool suitable for writing AppleScript in Lua via ScriptingBridge. (Mac OS X).
(5.1) - a bridge between Lua and all the Objective-C/CocoaTouch classes.
(5.1) - brings Objective-C-like syntax to Lua.
(LuaJIT 2) - A lightweight (Under 400 lines, pure Lua) bridge that exposes Objective-C objects&methods to Lua.
(5.1.x) - calling Lua from OCaml and vice-versa (tested only in Linux, should work with OS X).
(5.3) - Delphi XE5-XE7 Lua interface with OOP callback functions for Win32, Win64, Mac OS X, iOS and Android.
(5.1 to 5.3) - Aims to keep up-to-date Pascal bindings for the Lua library, both for Delphi and Freepascal.
(5.1) - Integrates Lua and Object Pascal languages. Allows Lua to manipulate components developed in Pascal/Delphi.
(5.1) - Delphi and VCL Lua interface and Util functions.
(5.1) - calling Lua from Delphi/Pascal.
(5.1) - for Delphi 2010 and XE.
(5.0) - Lua distribution for Delphi/Kylix/FreePascal. Includes header files, samples, some utils. For Windows, there are also
and project files for Visual Studio 6.
Last updated in 2003.
(5.0) - calling Lua from Delphi/Pascal.
(5.0) - calling Lua from Delphi/Pascal.
Pascal units lua, lualib, lauxlib corresponding closely to the usual C API and axiliary library.
(5.1) - calling Perl (5.8 and 5.10 streams) from Lua.
(5.1) - calling Lua from Perl (inline).
(5.1) - parse variables out of Lua code. Relies on Inline::Lua.
(5.1) - supplies the Lua regular expression dialect for Perl.
(5.1) - PHP extension which allows embedding the Lua interpreter in a PHP application.
(5.1) - PHP Standard Library written in Lua.
(5.1) - Lua/Python two-way bridge. Allows embedding of Lua interpreter in Python programs, and embedding of Python interpreter in Lua programs.
(LuaJIT2) - Embedded Lua in Python. Allows two-way communication between Python and Lua code and tries to adhere to common behaviour on both sides.
(5.1) - calling Lua from Ruby (calling Ruby from Lua is planned)
(5.0) - calling Lua from Ruby.
(5.1) - a binding of Tcl and Tk for Lua.
(5.0) - a Lua&-&Tcl bridge.
(4.0) - Tcl extension which embeds Lua into Tcl.
on Tcl.tk wiki.
is a new low-level system programming language that is designed to interoperate seamlessly with the Lua programming language.
Like C, Terra is a simple, statically-typed, compiled language with manual memory management. But unlike C, it is designed from the beginning to interoperate with Lua. Terra functions are first-class Lua values created using the terra keyword. When needed they are JIT-compiled to machine code.
You can use Terra and Lua as:
A scripting-language with high-performance extensions. While the performance of Lua and other dynamic languages is always getting better, a low-level of abstraction gives you predictable control of performance when you need it.
A JIT compiler for your software's DSLs. Meta-program Terra using Lua. allows you to compile domain-specific languages (DSLs) written in Lua into high-performance Terra code. Embedding Terra-Lua programs in other software as a library allows you to add a JIT-compiler into your existing software.
A stand-alone low-level language. Terra was designed so that it can run independently from Lua. In fact, if your final program doesn?t need Lua, you can save Terra code into a .o file or executable. In this use-case, Lua serves as a powerful meta-programming language. You can think of it as a replacement for C++ template metaprogramming with better syntax and nicer properties.
Frameworks
(5.1) - ORB in Lua ()
Windows COM
- (5.1/5.0) Lua interface to Microsoft's Component Object Model (COM).
Calling COM objects from Lua and implementing COM objects in Lua.
Windows .NET
(5.0) - A .NET/CLI library, wrapping the Lua API.
(5.1) - a library for integration between the Lua language and Microsoft .NET platform's Common Language Runtime (CLR). Lua scripts can use it to instantiate CLR objects, access properties, call methods, and even handle events with Lua functions.
(5.1) - a modification of
to provide definition of Lua functions using attributes and loaded into the Lua engine using reflection.
(5.2) - a fork of
which is active as of 2014
- embedded Lua environment for the Firefox web browser.
Allows Firefox extensions to be developed in Lua rather than JavaScript.
Implemented as an extension (XPI), written in XUL, JavaScript, and C++.
XML-RPC / SOAP
- a technique for synchronizing C enums with a Lua API
- greatly simplifies manual loading (GetProcAddress or dlsym) of Lua 5.1 shared library (.dll or .so)
& Last edited May 16,From Wikipedia, the free encyclopedia
Ming Bridges (: 喬毓明; : Qiáo Yùmíng) (born 5 November 1992) is a
singer-songwriter, actress and model.
Bridges was born in Australia to a British father and a Chinese Singaporean mother. They moved to Singapore when she was six months old. Growing up, she lived in Singapore for 16 years and studied at the
before moving to England. At 17, she received a performing arts scholarship to study at Wellington College, where she earned her
diploma in 2011. She briefly attended , studying business management before deciding to defer her studies in pursuit of a music career.
In 2006, at age 13, Bridges won Teenage magazine's Teenage Icon singing competition. In 2008, she played a lead role, Roxy, on the kids detective drama R.E.M.: The Next Generation, which aired in Singapore on the
channel's Kids Central, and won Best Children's Programme at the 2008 . Subsequently, she took on the role of Christine in 's drama series Red Thread that same year.[] After finishing her International Baccalaureate diploma in London, she moved back to Singapore to pursue a singing career. In 2012, she appeared on 's variety show It's a Small World III alongside a multi-national panel, to discuss issues of foreigners living in Singapore. In 2013, she appeared in the Chinese horror film "Ghost Child" as Shirley, and on the reality TV series Date A Star II, which sets up celebrities on dates with other celebrities and airs in Singapore on .
Bridges appeared as a cover model on the July 2013 issue of
Singapore and the January 2014 issue of
Bridges was signed to Funkie Monkies Productions in 2011 after she performed her song "Saya Nak Kamu Semula" for its directors, Luqman Taufeek and Fahim Fadzil. She has said this was the first time she played one of her songs for anyone. The song, which she wrote when she was 14, became her first single, released in November 2011. In February 2012, she released her first album, Sape Tahu, featuring nine songs in English and three in Mandarin.
Yǒuxiē Nánhái Bùnéng ?i (有些男孩不能爱, "Some Guys") reached number 8 on , Mǎsàikè Shìjiè (马赛克世界, "Mosaic World") made it into the top 10 on Y.E.S. 93.3 FM, and "DiBawah Musytari" charted on . In December 2012, Bridges released her second album, Hari Hari Ming, an all-mandarin album. Lèi Ruò Yǔ Xià (泪若雨下) reached number 2 on Y.E.S. 93.3 FM.[]
Bridges received the 2012 Music Act of the Year award from
Singapore magazine and the My Incredible Teen Icon award at the 2013 M:idea Youth Choice Awards. She also received two awards at the 2013 Singapore Entertainment Awards, for Best Local Singer, and Best Local Album for Ming Day. In 2012, she took part in
Beijing's Starry Starry Night concert.[] On 26 September 2013, she became the first Singaporean artist to perform on
Sessions, playing a set of seven of her songs in English and Mandarin, plus a cover of 's "," at Harbourfront Studios at the .
In January 2014, her third album, Morphosis, was released, consisting entirely of songs in English, all of which she composed. The album's first single was "Summertime Love". The second single, "You and I", was first performed on MTV Sessions.
Released: 2 February 2012
Label: Funkie Monkies Productions, Warner/Chappell Music (Beijing)
Formats: CD,
Released: 18 December 2012
Label: Funkie Monkies Productions
Formats: CD, digital distribution
Released: 3 January 2014
Label: Funkie Monkies Productions
Formats: CD, digital distribution
"I Want You Back"
Released: 18 January 2012
Label: Funkie Monkies Productions, Warner/Chappell Music (Beijing)
Formats: Digital download
"Summertime Love"
Released: 9 September 2013
Label: Funkie Monkies Productions
Formats: Digital distribution
R.E.M.: The New Generation
Two seasons
Red Thread
It's A Small World III
Herself, guest appearance
Ghost Child
Chinese horror/thriller film
Date a Star II
Reality TV series
Music Act of the Year,
Singapore magazine, 2012
My Incredible Teen Icon, M:idea Youth Choice Awards, 2013
Best Local Singer, Singapore Entertainment Awards, 2013
Best Local Album, Ming Day, Singapore Entertainment Awards, 2013
Trevor Tan (23 March 2013). . The Straits Times () 2013.
. . 18 August .
Tan Kee Yun,
, 31 March 2012.
. Avistaz.me. 17 June .
Tan Kee Yun,
AsiaOne, 3 October 2013.
Singapore, July 2013.
Amresh S. Jessy,
Malaysia, 6 January 2014.
Kevin Mathews,
, 3 October 2013.
. Mda.gov.sg 2013.
. Lifestyle.. 28 January .
. .sg. 29 January .
. Lollipop – The Straits Times. 6 May .
. Asiaone News. 27 September .
Natalie Yeo,
, 2 January 2014.
: Hidden categories:

我要回帖

更多关于 使命召唤10第二关卡死 的文章

 

随机推荐