dm_lua_lib Module

Auto-registration procedure of the DMPACK Lua API.

The postfix in the name of function luaopen_libdmpack() must match the name of the DMPACK shared library. This function is compatible to a library of the name libdmpack.so only.

The following procedures are registered by default:

  • deg2gon(deg) – degrees to gradians
  • deg2rad(deg) – degrees to radiants
  • gon2deg(gon) – gradians to degrees
  • gon2rad(gon) – gradians to radiants
  • rad2deg(rad) – radiants to degrees
  • rad2gon(rad) – radiants to gradians

Additionally, error codes, log parameters, and the GeoCOM API for Lua are exported as well.

Import the shared library libdmpack.so in Lua 5.4, and then call any of the procedures, for example:

require("libdmpack")

print(deg2gon(360.0))
-- Output: 400.0

Uses

  • module~~dm_lua_lib~~UsesGraph module~dm_lua_lib dm_lua_lib iso_c_binding iso_c_binding module~dm_lua_lib->iso_c_binding

Used by

  • module~~dm_lua_lib~~UsedByGraph module~dm_lua_lib dm_lua_lib module~dmpack dmpack module~dmpack->module~dm_lua_lib

Functions

public function luaopen_libdmpack(ptr) result(rc) bind(c))

Registers the Lua parameters and interfaces of the DMPACK API, including the GeoCOM API. This function is invoked automatically by Lua 5.4 if library libdmpack.so is loaded.

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in), value :: ptr

C pointer to Lua interpreter.

Return Value integer(kind=c_int)

Return code.