Jump to content
  • Advertisement
Sign in to follow this  
John Schultz

Added class inheritance support to SqPlus (Squirrel)

This topic is 4656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

http://www.squirrel-lang.org/forums/233/ShowPost.aspx Cpp classes can inherit from each other and Squirrel defined classes, and Squirrel defined classes can inherit from Cpp classes. See testSqPlus2.cpp for examples. The slight-increase in complexity for inheritance support can be compiled out by changing a compile time flag (when inheritance is not needed). Additionally, while constructors and destructors are automatically created and called, it is also possible to use custom constructors+destructors defined globally to allow custom constructor arguments to be used (without modifying the original class/struct).
      SQClassDef<NewTestObj>("NewTestObj").                         // If a special constructor+destructor are not needed, the auto-generated versions can be used.
                                                                    // Example methods for custom constructors:
        globalFuncVarArgs(constructNewTestObj,"constructor","*").   // Using a global constructor: useful in cases where a custom constructor/destructor are required and the original class is not to be modified.      
//        staticFuncVarArgs(NewTestObj::construct,"constructor").   // Using a static member constructor.
        globalFunc(globalFunc,"globalFunc").                        // Any global function can be registered in a class namespace (no 'this' pointer will be passed to the function, though the Squirrel class instance can be passed if desired (allowing access to the Cpp 'this' pointer)).
        globalFunc(globalClass,GlobalClass::func,"globalClassFunc").
        func(NewTestObj::newtestR1,"newtestR1").
        var(&NewTestObj::val,"val").
        var(&NewTestObj::s1,"s1").
        var(&NewTestObj::s2,"s2").
        constant(&NewTestObj::c1,"c1").
        constant(&NewTestObj::c2,"c2").
        funcVarArgs(NewTestObj::multiArgs,"multiArgs");

// No other code is required to setup/bind the class to script.


Latest version: http://www.brightland.com/sq/SQUIRREL2_0_5_sqplus.zip [Edited by - John Schultz on September 25, 2005 7:08:34 PM]

Share this post


Link to post
Share on other sites
Advertisement
Wow, thats great news! I was just looking at SqPlus for a project I'm in the design phase of. I saw your previous post about not having support for inheritence, and thought to myself "dang, if only he'd stick that in" ;)

Guess that made up my mind, will definately be using this! Thanks for the good work!

Share this post


Link to post
Share on other sites
Quote:
Original post by Rhalin
Wow, thats great news! I was just looking at SqPlus for a project I'm in the design phase of. I saw your previous post about not having support for inheritence, and thought to myself "dang, if only he'd stick that in" ;)

Guess that made up my mind, will definately be using this! Thanks for the good work!


You're welcome. I just checked out Alberto's new Eclipse-based debugger for Squirrel: impressive. It's also a syntax-highlighted development environment for Squirrel.

I have integrated the changes from Squirrel 2.0.4_w2 to 2.0.5 (stable) for SqPlus:
http://www.brightland.com/sq/SQUIRREL2_0_5_sqplus.zip

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!