Could somebody explain to me about "Extending and Embedding"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Could somebody explain to me about "Extending and Embedding"

jason zhang-4
I often heard "Extending and Embedding" about Lua. But what's the exact difinitions about them?
Could someone be kind to tell me? I am writing a internal training document about Lua, but be blocked
by these two definitions.
 
Thank you.
 
 
SRC-GUI1
Tel:86-10-88366185-866
Reply | Threaded
Open this post in threaded view
|

Re: Could somebody explain to me about "Extending and Embedding"

Kurt Jung
> I often heard "Extending and Embedding" about Lua. But what's the
> exact difinitions about them?

An application embeds Lua when it calls lua_open, that is, when it
creates a new Lua state. The Lua interpreter is the most familiar
case of this.

A library or host application extends Lua when it registers
functions (by means of lua_pushcclosure, lua_pushcfunction and
friends) to be called from Lua.

An embedding application often extends Lua as well, and an
extension library can embed Lua by opening new Lua states.

See http://twistedmatrix.com/users/glyph/rant/extendit.html for a
discussion of embedding and extending; it is written about Python
but applies to Lua as well.

-- 
Kurt Jung


Reply | Threaded
Open this post in threaded view
|

RE: Could somebody explain to me about "Extending and Embedding"

Richard Ranft
This is also discussed in an abstract way in the PiL book.  Chapter 24
starts with a description of this from the developers' point of view.  The
first 3 or 4 paragraphs should do the trick.

Rich

> > I often heard "Extending and Embedding" about Lua. But what's the
> > exact difinitions about them?
>
> An application embeds Lua when it calls lua_open, that is, when it
> creates a new Lua state. The Lua interpreter is the most familiar
> case of this.
>
> A library or host application extends Lua when it registers
> functions (by means of lua_pushcclosure, lua_pushcfunction and
> friends) to be called from Lua.
>
> An embedding application often extends Lua as well, and an
> extension library can embed Lua by opening new Lua states.


Reply | Threaded
Open this post in threaded view
|

Re: Could somebody explain to me about "Extending and Embedding"

jason zhang-4
Thank you two! 

----- Original Message ----- 
From: "Richard Ranft" <[hidden email]>
To: "Lua list" <[hidden email]>
Sent: Wednesday, September 20, 2006 9:32 PM
Subject: RE: Could somebody explain to me about "Extending and Embedding"


> This is also discussed in an abstract way in the PiL book.  Chapter 24
> starts with a description of this from the developers' point of view.  The
> first 3 or 4 paragraphs should do the trick.
> 
> Rich
> 
>> > I often heard "Extending and Embedding" about Lua. But what's the
>> > exact difinitions about them?
>>
>> An application embeds Lua when it calls lua_open, that is, when it
>> creates a new Lua state. The Lua interpreter is the most familiar
>> case of this.
>>
>> A library or host application extends Lua when it registers
>> functions (by means of lua_pushcclosure, lua_pushcfunction and
>> friends) to be called from Lua.
>>
>> An embedding application often extends Lua as well, and an
>> extension library can embed Lua by opening new Lua states.
> 
>