luaL_checkfilename -- get filename from the stack (V5.3)
const char *name =  luaL_checkfilename(lua_State *L, int numArg);
This is not an official Lua API but a Hollywood extension. 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_checklstring() because luaL_checkfilename() is able to work with linked files as well. For example, if the user passes the filename menulogo.png to 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.png to 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 never return NULL. If luaL_checkfilename() returns, then it has been successful as well. If there is an error, luaL_checkfilename() won't return control to you at all.

Designer compatibility

pointer to the lua_State
stack index to examine
file name specification

Show TOC