← Back to team overview

mudlet-makers team mailing list archive

Re: [Bug 1310372] [NEW] Start-up error messages from Lua interpreter only show first error

 

Yes, changing all the cases of 1 to -1 in both the
"lua_tostring(pGlobalLua, 1)" and the matching test
"lua_isstring(pGlobal, 1)" seems to fix it!

I.e. change from:
>     error = luaL_dostring( pGlobalLua, "require \"lfs\"" );
>     if( error != 0 )
>     {
>         string e = "no error message available from Lua";
>         if( lua_isstring( pGlobalLua, 1 ) )
>         {
>             e = "Lua error:";
>             e+=lua_tostring( pGlobalLua, 1 );
>         }
>         QString msg = "[ ERROR ] cannot find Lua module lfs (Lua File System).";
>         msg.append( e.c_str() );
>         gSysErrors << msg;
>     }
>     else
>     {
>         QString msg = "[  OK  ]  -  Lua module lfs loaded";
>         gSysErrors << msg;
>     }

to:
>     error = luaL_dostring( pGlobalLua, "require \"lfs\"" );
>     if( error != 0 )
>     {
>         string e = "no error message available from Lua";
>         if( lua_isstring( pGlobalLua, -1 ) )
>         {
>             e = "Lua error:";
>             e+=lua_tostring( pGlobalLua, -1 );
>         }
>         QString msg = "[ ERROR ] cannot find Lua module lfs (Lua File System).";
>         msg.append( e.c_str() );
>         gSysErrors << msg;
>     }
>     else
>     {
>         QString msg = "[  OK  ]  -  Lua module lfs loaded";
>         gSysErrors << msg;
>     }

Sorts it out.  I'll fix up my branches that are down as open pull
requests into Chris's GH mudletDev repository.

On 20/04/14 21:24, Vadim Peretokin wrote:
> Try -1 instead of 1, can you tell me if that fixes it?
> 
> -1 is a relative location for the stack.
> 
> 
> On Mon, Apr 21, 2014 at 6:07 AM, Stephen Lyons
> <1310372@xxxxxxxxxxxxxxxxxx>wrote:
> 
>> Public bug reported:
>>
>> In https://bugs.launchpad.net/mudlet/+bug/1310361 I investigated an
>> issue that revealed a further matter that I am not skilled enough to
>> fix.  If more than one required external module is missing the part of
>> the error messages that are shown that come from the lua interpreter
>> itself are repeats of the message for the first problem.
>>
>> I think the messages are supposed to show the "module loader" arguments
>> that have been tried for the particular module - which equates to a
>> 'sort of' wildcarded filename.  Studying either of the composite 'screen
>> shots' from that bug report,  and I've attached a copy from my 'fixed'
>> code of that one (well I think it is clearer but obviously I'm biased),
>> you can see that there are three sets of such lines and they all relate
>> to the lua rex_pcre module even though there are three different modules
>> that are causing problems.
>>
>> Stepping through the code in the Debugger shows that the lines in the
>> end of TLuaIntrepreter::initLuaGlobals() that pull the error message
>> text from the Lua state/stack (?) with calls to "lua_tostring(
>> pGlobalLua, 1 )" are producing the same string each time.  Now I am not
>> an expert in Lua but it seems to me that we are failing to do something
>> to clean up the stack after an error, can someone who understands what
>> is happening here comment/fix this?
>>
>> ** Affects: mudlet
>>      Importance: Undecided
>>          Status: New
>>
>> ** Attachment added: "post-fix.png"
>>
>> https://bugs.launchpad.net/bugs/1310372/+attachment/4090362/+files/post-fix.png
>>
>> --
>> You received this bug notification because you are a member of Mudlet
>> Makers, which is subscribed to Mudlet.
>> https://bugs.launchpad.net/bugs/1310372
>>
>> Title:
>>   Start-up error messages from Lua interpreter only show first error
>>
>> Status in Mudlet the MUD client:
>>   New
>>
>> Bug description:
>>   In https://bugs.launchpad.net/mudlet/+bug/1310361 I investigated an
>>   issue that revealed a further matter that I am not skilled enough to
>>   fix.  If more than one required external module is missing the part of
>>   the error messages that are shown that come from the lua interpreter
>>   itself are repeats of the message for the first problem.
>>
>>   I think the messages are supposed to show the "module loader"
>>   arguments that have been tried for the particular module - which
>>   equates to a 'sort of' wildcarded filename.  Studying either of the
>>   composite 'screen shots' from that bug report,  and I've attached a
>>   copy from my 'fixed' code of that one (well I think it is clearer but
>>   obviously I'm biased), you can see that there are three sets of such
>>   lines and they all relate to the lua rex_pcre module even though there
>>   are three different modules that are causing problems.
>>
>>   Stepping through the code in the Debugger shows that the lines in the
>>   end of TLuaIntrepreter::initLuaGlobals() that pull the error message
>>   text from the Lua state/stack (?) with calls to "lua_tostring(
>>   pGlobalLua, 1 )" are producing the same string each time.  Now I am
>>   not an expert in Lua but it seems to me that we are failing to do
>>   something to clean up the stack after an error, can someone who
>>   understands what is happening here comment/fix this?
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/mudlet/+bug/1310372/+subscriptions
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~mudlet-makers
>> Post to     : mudlet-makers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~mudlet-makers
>> More help   : https://help.launchpad.net/ListHelp
>>
>

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1310372

Title:
  Start-up error messages from Lua interpreter only show first error

Status in Mudlet the MUD client:
  New

Bug description:
  In https://bugs.launchpad.net/mudlet/+bug/1310361 I investigated an
  issue that revealed a further matter that I am not skilled enough to
  fix.  If more than one required external module is missing the part of
  the error messages that are shown that come from the lua interpreter
  itself are repeats of the message for the first problem.

  I think the messages are supposed to show the "module loader"
  arguments that have been tried for the particular module - which
  equates to a 'sort of' wildcarded filename.  Studying either of the
  composite 'screen shots' from that bug report,  and I've attached a
  copy from my 'fixed' code of that one (well I think it is clearer but
  obviously I'm biased), you can see that there are three sets of such
  lines and they all relate to the lua rex_pcre module even though there
  are three different modules that are causing problems.

  Stepping through the code in the Debugger shows that the lines in the
  end of TLuaIntrepreter::initLuaGlobals() that pull the error message
  text from the Lua state/stack (?) with calls to "lua_tostring(
  pGlobalLua, 1 )" are producing the same string each time.  Now I am
  not an expert in Lua but it seems to me that we are failing to do
  something to clean up the stack after an error, can someone who
  understands what is happening here comment/fix this?

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1310372/+subscriptions


References