Module lua_finder

Lua library finder.

Functions

liblua_version (filename) Parses version number from the given Lua library using find_string_in_binary.
libluajit_version (filename) Parses version number from the given LuaJIT library using find_string_in_binary.
luah_version (filename) Reads version number from the given lua.h file.
luajith_version (filename) Reads version number from the given luajit.h file.
find_incdir (lua_name, lua_ver, List) Looking for a directory containing Lua header file lua_name in common locations.
find_liblua (lib_ext, lua_name, lua_ver, dirs) Looking for Lua or LuaJIT library in common locations.

Local Functions

find_string_in_binary (pattern, filename) Looks for string specified by the pattern in the given binary file.


Functions

liblua_version (filename)
Parses version number from the given Lua library using find_string_in_binary.

Parameters:

  • filename string Path of the Lua library.

Returns:

    string Version number in format x.y.z.

Or

  1. nil
  2. string An error message.
libluajit_version (filename)
Parses version number from the given LuaJIT library using find_string_in_binary.

Parameters:

  • filename string Path of the LuaJIT library.

Returns:

    string Version number in format x.y.z.

Or

  1. nil
  2. string An error message.
luah_version (filename)
Reads version number from the given lua.h file.

Parameters:

  • filename string Path of the lua.h file.

Returns:

    string Version number in format x.y.z.

Or

  1. nil
  2. string An error message.
luajith_version (filename)
Reads version number from the given luajit.h file.

Parameters:

  • filename string Path of the luajit.h file.

Returns:

    string Version number in format x.y.z.

Or

  1. nil
  2. string An error message.
find_incdir (lua_name, lua_ver, List)
Looking for a directory containing Lua header file lua_name in common locations.

Parameters:

  • lua_name optional string Base name of the Lua header file; "lua", or "luajit" (default: "lua").
  • lua_ver optional string Version of the header file to search for in format x.y or x.y.z.
  • List optional {string,...} of prefixes (directories) to search. If nil, the default list of directories is used.

Returns:

  1. string File path of the found directory.
  2. string Version of the found header file in format x.y.z.

Or

    nil Not found.
find_liblua (lib_ext, lua_name, lua_ver, dirs)
Looking for Lua or LuaJIT library in common locations.

Parameters:

  • lib_ext string File extension of the library to search for.
  • lua_name optional string Base name of the Lua library; typically "lua", or "luajit" (default: "lua").
  • lua_ver optional string Version of the Lua(JIT) library to search for (default: "5.3").
  • dirs optional {string,...} List of prefixes (directories) to search. If nil, the default list of prefixes is used.

Returns:

  1. string File path of the found Lua library.
  2. string Version of the found Lua library in format x.y.z.

Or

    nil Not found.

Local Functions

find_string_in_binary (pattern, filename)
Looks for string specified by the pattern in the given binary file.

This function uses command strings. It works for both static and dynamic library on Linux and macOS.

Parameters:

  • pattern string The string pattern to search for.
  • filename string Path of the file to scan.

Returns:

    string Captured substring, or nil if not found.

Or

  1. nil
  2. An error message.
generated by LDoc 1.4.6