lua-users home
lua-l archive

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


> removal of the getc() from lauxlib.c

done.


>  and the addition of GetModuleFileName() substitution for Win32 in
> LUA_CPATH (and maybe LUA_PATH).

Done for both: the following function is called when the path is set
(the path is on the stack top):

void setprogdir (lua_State *L) {
  char buff[MAX_PATH + 1];
  DWORD nsize = sizeof(buff)/sizeof(char);
  DWORD n = GetModuleFileName(NULL, buff, nsize);
  if (n == 0 || n == nsize)
    luaL_error(L, "unable to get ModuleFileName");
  PathRemoveFileSpec(buff);
  luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);
  lua_remove(L, -2);  /* remove original string */
}

(LUA_EXECDIR is defined as "!")

-- Roberto