Re: Executing a script multiple times
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Executing a script multiple times
- From: "James Dennett" <james.dennett@...>
- Date: 2008年9月29日 10:06:25 -0700
On Mon, Sep 29, 2008 at 9:57 AM, Juan Manuel Alvarez <naicigam@gmail.com> wrote:
> Hi everyone! I am new to LUA and I have a little question.
>
> I am trying to execute a script multiple times.
> I first called luaL_loadbuffer one time and lua_pcall two times. The
> second time calling lua_pcall I received an error message. I start
> looking and I found something in the documentation about pcall: "Then
> the program calls lua_pcall, which pops the chunk from the stack and
> runs it in protected mode", so I finally discovered what my error was
> =o)
>
> Now I have some questions: How much does luaL_loadbuffer affect
> performance? Is there any way to precompile a script from the C API
> and call it multiple times? (since I only found a way to precompile it
> from command-line).
Store the loaded chunked in a variable (i.e., make it a named
function) and then call that function repeatedly.
-- James