3

I have an the need to use a scripting language, but I have a horrible list of requirements. The workstations(PS2 Linux) at uni do not let us have admin access and have a very old version of GCC).

Can anybody recommend a script language that ...

  • Work on Linux
  • GCC 2.95.2 :(
  • No need for admin access
  • Easy to integrate with C++
  • No need to for additional libraries
  • No boost (its just to big for the networked drives at uni, I have complained on numerous occasions, but they feel 1 gig suits all students regardless of a computing course or a nursing course.)

The scripts will be doing small amounts of logic for game-objects.

Luabind would be my first choice, but boost makes it impossible, and since the workstations are reset all the time, I would have to reinstall everything :(

15
  • 3
    why are you forced to use their machine? you can easily get one that is better Commented Jul 23, 2011 at 9:11
  • 2
    You could try SpiderMonkey (JavaScript) perhaps... Commented Jul 23, 2011 at 9:11
  • 2
    You can dowload/build and install gcc to a local directory (ie not a system directory). You just set your path to the local directory when using gcc Commented Jul 23, 2011 at 9:12
  • 1
    are you able to install onto a thumbdrive and plug it into that machine? Commented Jul 23, 2011 at 9:28
  • 1
    PS 2.95 is very old and very broken. It was not until 2.96 that I would even consider it worth using in any real projects. Commented Jul 23, 2011 at 9:46

2 Answers 2

4

I want to recommend Angelscript:

http://www.angelcode.com/angelscript/

It is damn easy to integrate with C++ and has threading and all. Sample integration:

r = engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(print), asCALL_CDECL); assert( r >= 0 );

You cannot have it more easy. Classes have the same syntax but asMETHOD instead of asFUNCTION. It also supports exporting classes, having factories and comes with some premades like string and math. The language itself is a mix of C++, Java and Python, but really good.

Try it, I fell in love with it once I understood how to use it.

No scripting language I tried was so easy to integrate like Angelscript. And I tried quite a lot, like Python, LUA, Javascript etc.

edit: Some Code from my program, shows the integration of a class for you:

// Registering the interface to angelscript
void NLBoundingBox::registerWithAngelScript( asIScriptEngine* e )
{    
    AS_ERR_CHECK(e->RegisterObjectType("NLBoundingBox", 0, asOBJ_REF));
    AS_ERR_CHECK(e->RegisterObjectMethod("NLBoundingBox", "bool intersects(const NLBoundingBox@)", asMETHOD(NLBoundingBox, intersects), asCALL_THISCALL));
    AS_ERR_CHECK(e->RegisterObjectMethod("NLBoundingBox", "bool isPointInside(f32 x, f32 y)", asMETHODPR(NLBoundingBox, isPointInside, (f32,f32), bool), asCALL_THISCALL));
    AS_ERR_CHECK(e->RegisterObjectMethod("NLBoundingBox", "void translate(f32 x, f32 y)", asMETHODPR(NLBoundingBox, translate, (f32,f32), void), asCALL_THISCALL));
    AS_ERR_CHECK(e->RegisterObjectMethod("NLBoundingBox", "void translateTo(f32 x, f32 y)", asMETHODPR(NLBoundingBox, translateTo, (f32,f32), void), asCALL_THISCALL));
    AS_ERR_CHECK(e->RegisterObjectMethod("NLBoundingBox", "void rotateAroundCenter(f32 angle)", asMETHOD(NLBoundingBox, rotateAroundCenter), asCALL_THISCALL));

    // Behaviour: Factory and Refs
    AS_ERR_CHECK(e->RegisterObjectBehaviour("NLBoundingBox", asBEHAVE_FACTORY, "NLBoundingBox@ NLBoundingBox()", asFUNCTIONPR(factory, (void), NLBoundingBox*), asCALL_STDCALL));
    AS_ERR_CHECK(e->RegisterObjectBehaviour("NLBoundingBox", asBEHAVE_RELEASE, "void NLBoundingBox()", asMETHOD(NLBoundingBox, release), asCALL_THISCALL));
    AS_ERR_CHECK(e->RegisterObjectBehaviour("NLBoundingBox", asBEHAVE_ADDREF, "void NLBoundingBox()", asMETHOD(NLBoundingBox, addRef), asCALL_THISCALL));
}
Sign up to request clarification or add additional context in comments.

2 Comments

Lua is not an acronym; it should not be in all caps. Sorry; personal pet peeve. Also, you may want to point out that the Angelscript language is statically typed, so it loses some of the advantages of most scripting languages.
I shall also add that it is intrusive.
2

Just use Lua, and don't use their machines. If you must, keep your full dev environment and dependencies on a flash drive. Lua is literally the industry standard for this.

4 Comments

yes i would recommend lua, we have been using it with greath sucess.
@禪 師 無 I'd rather not have to buy my own PS2 and Linux Dev kit. @Naresh Lua would be my first preference.
You can also give LuaJIT a spin too, even if you don't use the JIT for what ever reason, the VM is still pretty powerful
I've ended writing my own Lua glue code, as I cant get any of the libraries working on such an old spec.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.