[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: My brain hurts
- From: "Paul Tankard" <Paul.Tankard@...>
- Date: Fri, 19 Sep 2003 14:02:02 +0100
Hello fellow Luarers :),
I have spent the last few weeks ploughing through the Lua mail archives (big
as it is) and doing general research on the net to do what a mass majority
of people seem to be wanting to do now, and thats impliment Lua as part of
my game entities to control them, now the first thing I did with Lua is to
use it as a configuration processor which it seems to do lovingly out of the
box, however, before I delve in making the mistake of trying to impliment
Lua incorrectly for my game needs I thought I would chuck some questions
into the melting pot to clarify things as my brain is now at melting point.
Firstly, my system basic needs are to apply a script for each entity which
in turn controls that entity.. seems simple enough.. but I do however want
each entity to beable to reference each other... so the first implementation
I thought of was.....
have a main luavm, register all functions to it, then for each entity have a
lua_newthread and do a lua_loadbuffer to the newthread with that particular
script... now my head started melting when I thought of the calling process
to the Lua script, I mean if I had a few threads each using a script which
contained a function of the same name, say initialise, could I do a
lua_getglobal in that particular newthread for "initialise" then a lua_call
and it would call the corrects scripts function, or does it get set
globally-globally so any script that has a function named the same will
override the previous declaration like you would do function=nil to remove
it ? this is obviously not the ideal way to do this.. especially if I have
lots of entities that share the same script as it's using unnecessary
overhead, but it would work ;)
secondly I could have functions defined in tables then creating an object
and using self everywhere this would make sure I don't have repeated chunks
of script code and make it more c++ class orientated, but the problem is
creating the actual object from C/C++, I mean would I just purge all scripts
I needed into one script file then do lua_loadbuffer to the main lua state,
and then for each entity do something like lua_dostring("entity1 =
createentity:new("blah")); and get the function from the table of entity1
and call that etc.
or is there some other generic way that I'm just missing ? the more I'm
having to think about it the more my head hurts so any feedback is more than
welcome :)
also, does anyone know of a windows tool/util that will take a list of mails
(namely lua-l-archive) and process it to news format ? it's bloody damn hard
having to spend time searching for stuff for examples when you don't know
what to search for in the first place... it's kind of like using MSDN ;)
cheers,
PT