lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

  Roughly what is the performance difference from say calling 100 scripts
(from C), verses calling a single script that performs the same work as the
100 individual calls?  In other words how bad is the penalty for turning
execution over to LUA (assuming everything is precompiled).

  I am also in the process of incorporating LUA into my game engine for
similar use - where the content creators can write script handlers that
process every entity instance.  The actual scripts will be short and
simplistic, but they would be called often.  It best suites my object
oriented paradigm to have lots of calls - that is how my current C++
handlers function.  However I can arrange things differently if there is a
substantial penalty just for calling into LUA.

  This is mainly for Pocket PC use, so I've been hesitant to provide any
scripting at all because performance is incredibly important (most of my
critical routines are hand-written ASM), so it is a huge step in the other
direction to support scripting.  However my thought is to allow content
creators to design a game via scripting, and once they have things finalized
I could then rewrite their scripts in C purely for performance.  3rd-party
mods could still be done in LUA, however there would be some performance

  Dan East

-----Original Message-----
[]On Behalf Of Grisha
Sent: Thursday, June 10, 2004 10:36 AM
To: Lua list
Subject: Re: LUA Shell inside my application

Hi, Andreas

I can't advise calling any script for every object per frame, but if your
object count is small probably it'l work fast enough. Generally Lua is ten
times slower than C code (which is good for scripting language), but
probably you will need to benchmark your scripts yourself.

Lua does have the ability to precompile scripts, you can take a look at the
luac.c file in your lua distribution. Note that scripts are compiled on
load, so compiling in advance will reduce only load time, not execution


----- Original Message -----
From: "Andreas Volz" <>

> Another reason I like to embed LUA is because I want to give users the
> ability to write LUA scripts which are executed every frame, give data
> to LUA, do some "things" and give them back to C++. Is LUA fast enough
> to so this (25fps)? It's not much data, only 5-10 objects with some
> x/y/z/angle data. Perhaps LUA has the ability to precompile scripts or
> cache them if they're used very often?