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
- nil
- 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
- nil
- 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
- nil
- string An error message.
- filename
string
Path of the
- 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
- nil
- string An error message.
- filename
string
Path of the
- 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
orx.y.z
. - List
optional {string,...}
of prefixes (directories) to search.
If
nil
, the default list of directories is used.
Returns:
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:
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:
Returns:
-
string
Captured substring, or nil if not found.
Or
- nil
- An error message.