LUA_QS was removed in Lua 5.4.
In Lua 5.1-5.3, it just
    #define LUA_QL(x)       "'" x "'"
    #define LUA_QS          LUA_QL("%s")
So this patch can be applied unconditionally.

No upstream report since the GitHub repository has been archived.

--- hpdf.c.orig	2018-04-09 15:46:15
+++ hpdf.c	2023-03-19 05:51:03
@@ -482,7 +482,7 @@
   if (lua_isnumber(L, -1)) {
     Num = (HPDF_REAL) lua_tonumber(L, -1);
   } else {
-    luaL_error(L, "field " LUA_QS " not found", NameStr);
+    luaL_error(L, "field '%s' not found", NameStr);
   }
   lua_pop(L, 1);
   /* Stk: ... Tbl */
@@ -531,7 +531,7 @@
   if (lua_isnumber(L, -1)) {
     Num = lua_tointeger(L, -1);
   } else {
-    luaL_error(L, "field " LUA_QS " not found", NameStr);
+    luaL_error(L, "field '%s' not found", NameStr);
   }
   lua_pop(L, 1);
   /* Stk: ... Tbl */
@@ -555,7 +555,7 @@
   /* Stk: ... RctTbl Str? */
   Str = lua_tostring(L, -1);
   if (! Str) {
-    luaL_error(L, "expecting character field " LUA_QS, NameStr);
+    luaL_error(L, "expecting character field '%s'", NameStr);
   } else {
     Ch = *Str;
   }
