Re: embedding scripting into a program:a few questions

  • From: Tyler Littlefield <tyler@xxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Sun, 7 Mar 2010 19:37:46 -0700

Hello,
Bevire I switched to angelscript, I was bouncing around the idea of Lua. From 
what I read, it doesn't support inheritance or classes, so I'm not quite sure 
how I'd embed an OO setup like I want into a functional setup and get the same 
sort of layout or design I'm working toward.

                Thanks,
Tyler Littlefield
        http://tds-solutions.net
        Twitter: sorressean

On Mar 7, 2010, at 7:32 PM, Andreas Stefik wrote:

> Tyler,
> 
> This is just a thought, and you can discount it if you wish, but are you 
> familiar with the programming language LUA? LUA is a scripting language used 
> all the time in commercial video games (e.g., world of warcraft). The reason 
> it is used is because they have a fancy way of binding between C++ and the 
> LUA scripts, which makes doing this kind of interface relatively 
> straightforward. 
> 
> I'm hardly an expert on the details, but if it were me digging around in this 
> area, I might consider using LUA scripts and basically using its internal 
> system of binding between C++ and the scripts.
> 
> Stefik
> 
> On Sun, Mar 7, 2010 at 8:29 PM, Tyler Littlefield <tyler@xxxxxxxxxxxxx> wrote:
> Hello Laura,
> The idea is that the world class be able to be exposed to the language--I 
> don't need to add methods to the world class. What I do need to do, and what 
> seems to be causing the issue is the component setup; All components will be 
> loaded at startup and as they're added, but I need to be able to inherit the 
> c++ component class and add to it in order to create scripted components, 
> then I can just register them with the world class.
> The issue is making the scripted components be usable. Obviously I can't 
> access a scripted component from c++, or I could through it's basic 
> functionality, but the idea is for the components to be able to be added to 
> any object whether scripted or not.
> 
>                Thanks,
> Tyler Littlefield
>        http://tds-solutions.net
>        Twitter: sorressean
> 
> On Mar 7, 2010, at 7:23 PM, qubit wrote:
> 
> > Hi Ty --
> > Did I read once that your base is implemented in C++?
> > Let me clarify what you are saying you want to do:
> > 1. class A in your scripting language needs to interface with class World in
> > your base, and use its methods, and also to add methods of its own, and to
> > do this dynamically. Right?
> > 2. These new methods need to access class World in some way.  Do they need
> > to go so far as to touch private or protected data?  Since you want dynamic
> > insertion/removal of methods in class A, these methods will need to be able
> > to work with World without being members of World.
> > 3. As an aside, you could of course dynamically create a new inherited class
> > C for each method m(), which is derived from World and therefore can use
> > World's protected and public data.    m() can be a virtual or nonvirtual
> > method.  But this all has to be done in the interface to your scripting
> > language.  This is an interesting problem, as it almost requires that the
> > scripting language have the same inheritance structure as C++ to make the
> > implementation fall out cleanly.  But who ever heard of a clean
> > implementation in the "real world"...*smile*
> > Now, if your implementation goes so far as to create derived classes with
> > their own virtual table for each function added to A, you will need some
> > dynamic linking to pull it off.
> > I'll have to think on this one for a while.
> >
> > Hey Ty, great job picking an interesting project.  That should go really
> > well on a resumé.
> > Happy hacking.
> > --le
> >
> > ----- Original Message -----
> > From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
> > To: <programmingblind@xxxxxxxxxxxxx>
> > Sent: Sunday, March 07, 2010 6:12 PM
> > Subject: embedding scripting into a program:a few questions
> >
> >
> > Hello all,
> > As some of you may know, I'm working on a custom mud base that I will be
> > releasing to the public and probably using for my own mud in the near
> > future.
> > I've got most of the stuff I want handled, except scripting; I was told to
> > use Angelscript and was taking a look at it, but it seems to not be to well
> > documented, so maybe someone has another idea.
> >
> > What I want, is to be able to make the world class (which stores a list of
> > players, rooms, mobs, etc) accessible to the scripting language I use.
> > Secondly, I want to expose events so that the language can attach it's own
> > functions to them.
> > Third and possibly more dificult, I want to expose my component system,
> > which I will explain.
> >
> > Rather than using a is-a setup (through inheritance), I decided to go with a
> > has-a setup. This provides some really cool ideas for design, such as being
> > able to let clothing use containers if you decide that your shorts need
> > pockets, without either moving container functionality up the inheritance,
> > or using a multiple-inheritance setup, which can become messy. So, the
> > components get loaded with the object from a list. I can easily use an
> > AddComponent function to add the component to the list, but I'd like to
> > allow builders and coders that I don't want using shell or that have an idea
> > for a component to be able to build one in the language of choice, then
> > register it with the dictionary that is used for holding components and
> > allowing other objects to use this setup. So, in short I need a sort of
> > transparent way to communicate back and forth, and not for the scripting
> > language of choice to just control the driver, etc.
> >
> > Thanks,
> > Tyler Littlefield
> > http://tds-solutions.net
> > Twitter: sorressean
> >
> > __________
> > View the list's information and change your settings at
> > //www.freelists.org/list/programmingblind
> >
> > __________
> > View the list's information and change your settings at
> > //www.freelists.org/list/programmingblind
> 
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
> 
> 

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: