lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This is a bit of a long shot, but I thought some of you Lua gurus might be able to help...

I am using Lua 5.0 beta in a Win32 app (MFC).  I have been using it for months with no troubles.  However, I want to add loadmodule (the 12-18-2002 version from castanyo@yahoo.es) to the project.  After a bit of manipulation to make loadmodule.c to work in my project, I am pretty happy with the results.  I can call module.load("MyModule") and it works great.  I can call lua functions that get added from the DLL as expected.

The problem is that if I call module.load during runtime, I will always get an access violation when my application exits.  The access violation occurs here (ltable.c):

/*
** search function for strings
*/
const TObject *luaH_getstr (Table *t, TString *key) {
  Node *n = hashstr(t, key);
  do {  /* check whether `key' is somewhere in the chain */
>>>> THIS LINE >>>>    if (ttisstring(key(n)) && tsvalue(key(n)) == key)
      return val(n);  /* that's it */
    else n = n->next;
  } while (n);
  return &luaO_nilobject;
}

Here is the call stack: