Rebased fix replay

I have rebased (from current development branch) and reorganised my fixes and enhancements to the replay system, including putting some magic into the files so they can be identified more readily.  Hopefully these modifications and fixes can be adopted in their entirety, as they are interlinked - removing one step may clobber later ones...

This replaces #129 entirely and I will close that one now.
I'd say because the user may not care what the code is but the message is
more useful. So it's a matter of typing:
ret_val, could_care_less, message_to_echo = func();
vs
ret_val, message_to_echo = func();


On Fri, Sep 19, 2014 at 9:49 AM, Stephen Lyons <notifications@github.com>
wrote:

> In src/TLuaInterpreter.cpp:
>
> > +        retCode = -1;
> > +    switch( retCode ) {
> > +        case 0: // OK, remainder includes canonical pathFile of replay file
> > +            lua_pushnumber( L, result.left(1).toInt() );
> > +            lua_pushstring( L, result.mid(1).toUtf8() );
> > +            break;
> > +        case 1: // Replay active in this profile
> > +        case 2: // Replay active in other profile
> > +        case 3: // File does not exist
> > +        case 4: // File is not readable
> > +        case 5: // Replay file version is too high, newer than we understand...
> > +            lua_pushnumber( L, result.left(1).toInt() );
> > +            lua_pushstring( L, result.mid(1).toUtf8() );
> > +            break;
> > +        default:
> > +            lua_pushstring( L, tr( "loadRawFile: unexpected internal error code: \"%1\"!" ).arg( result.left(1) ).toUtf8() );
>
> For clarification: are nil and false are treated the same? So that
> returning a boolean *true* on success and *false* (+message) on failure
> is also reasonable? I would like to return:
>
> {true/false} {code 0-5} {appropriate, possibly translated to users language choice, message}
>
> however you are suggesting:
>
> {true/false} {appropriate, possibly translated to users language choice, message} {code 0-5}
>
> I know it is not an issue right now but I am thinking ahead to the
> possibility of supporting more than just English and using a numeric result
> code could be easier for script writers IMHO! OTOH using a tertiary numeric
> code as you suggest is least likely to break existing things that already
> adhere to the paradigm that you say is the standard for Lua so I guess that
> is the way to go... expect a further commit shortly! [image: :octocat:]
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Mudlet/Mudlet/pull/147/files#r17784829>.
>