const char *name = luaL_checkfilename(lua_State *L, int numArg);
luaL_checkfilename()checks if there is a filename at the given stack index. When working with files, you should always use this function instead of
luaL_checkfilename()is able to work with linked files as well. For example, if the user passes the filename
menulogo.pngto your function and this file does not physically exist, but has been linked to your applet or executable using Hollywood's ‘-linkfiles’ option,
luaL_checkfilename()will automatically set up a special virtual file name specification that is understood by hw_FOpen() and hw_TranslateFileName() and return it to you.
luaL_checklstring(), however, would just return the string
menulogo.pngto you, leading to a failure as soon as you try to open this non-existent file.
Please note that like all other
luaL_checkxxx() functions, this function will
immediately jump into Hollywood's error handler if an error occurs. It will
luaL_checkfilename() returns, then it has been successful
as well. If there is an error,
luaL_checkfilename() won't return control to you