[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE : Building a system using Lua - question following the "MyBrainHurts" mail.
- From: "Jacky Buyck" <jacky.buyck@...>
- Date: Sun, 21 Sep 2003 15:53:18 +0200
I'm ok with the aspects of namespace but I've a particular pb to solve :
the function that update scripted element call the same script function
because I want to expose to scripter user the same interface.
If I say to them to simply put the entity behavior in a given function
and after that they can call their own function from this point then it
more easier. This is why I need multiple VM. In the other case I can't
see how I can use name space (maybe by assigning a function names to an
entity instead of a script ... I'll think to that).
-----Message d'origine-----
De : lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] De la part de Paul Tankard
Envoyé : samedi 20 septembre 2003 12:57
À : Lua list
Objet : RE: Building a system using Lua - question following the
"MyBrainHurts" mail.
personally for ingame usage I don't think using multiple VM's is
necessary as Michael said, use namespaces. so the way I will be
implementing Lua for now ;) is to have one VM and have each script use a
namespace (read table) and my application will setup any entities using
the correct namespace.. the only downfall of this is knowing what the
namespace is called, I mean, if you enable a user to create a random
script which follows some basic rules, like the table should contain
certain functions, you still have the problem of the host machine
knowing what namespace is used, this isn't a problem if your dealing
with everything via script because you can amend you script easily, but
when your assigning script to entities via some form of editor this
becomes a problem.. unless you have another rule stating the namespace
should match the script name.. so.. (untested script follows, just
example ;)
--enemy.lua
enemy= {
PositionX = 0.0,
PositionY = 0.0,
PositionZ = 0.0
}
function enemy:new()
return {}
end
function enemy:Initialise(x,y,z)
self.PositionX,self.PositionY,self.PositionZ = x,y,z
end
function enemy:Update(time)
self.PositionX = (self.PositionX + 1.0) * time
end
then you can assume from the filename what the namespace is.. this is
very ugly and prone to errors, but until I understand a little more of
the workings and features of Lua I'm stuck in doing it this way for the
time being.
Regards,
PT
[Big snip]
>-----------------------------------------------------------------------
>-
>----------------
>A multiple Virtual Machine architecture :