/* Convert string 's' to a Lua number (put in 'result'). Return NULL on fail or the address of the ending '\0' on success. 'pmode' points to (and 'mode' contains) special things in the string: */
static const char* l_str2d(const char *s, lua_Number *result)
/* Convert string 's' to a Lua number (put in 'result'). Return NULL on fail or the address of the ending '\0' on success. 'pmode' points to (and 'mode' contains) special things in the string: */
static const char* l_str2d(const char *s, lua_Number *result)
{
    char buff[L_MAXLENNUM + 1];
    const char *pdot = strchr(s, '.');
    if (strlen(s) > L_MAXLENNUM || pdot == NULL)
      return NULL;
    strcpy(buff, s);
    buff[pdot - s] = lua_getlocaledecpoint();
    endptr = l_str2dloc(buff, result, mode);
    if (endptr != NULL)
      endptr = s + (endptr - buff);
  }
  return endptr;
}