{"id":18847810,"url":"https://github.com/interkosmos/fortran-lua54","last_synced_at":"2025-08-08T06:17:23.604Z","repository":{"id":191516970,"uuid":"684818355","full_name":"interkosmos/fortran-lua54","owner":"interkosmos","description":"Fortran 2008 interface bindings to Lua 5.4","archived":false,"fork":false,"pushed_at":"2024-03-03T13:27:10.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T05:43:13.208Z","etag":null,"topics":["fortran","fortran-2008","fortran-package-manager","fpm","lua","lua54"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interkosmos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-29T23:18:58.000Z","updated_at":"2025-05-11T03:54:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"dd975177-4c95-40b2-b4ce-d1a2c13a6d10","html_url":"https://github.com/interkosmos/fortran-lua54","commit_stats":null,"previous_names":["interkosmos/fortran-lua54"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/interkosmos/fortran-lua54","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua54","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua54/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua54/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua54/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interkosmos","download_url":"https://codeload.github.com/interkosmos/fortran-lua54/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua54/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264113255,"owners_count":23559337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","fortran-2008","fortran-package-manager","fpm","lua","lua54"],"created_at":"2024-11-08T03:09:44.247Z","updated_at":"2025-07-07T16:32:14.856Z","avatar_url":"https://github.com/interkosmos.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fortran-lua54\n\nA collection of ISO C binding interfaces to Lua 5.4 for Fortran 2008, to call\nLua from Fortran and vice versa.\n\nSimilar projects:\n\n* [AOTUS](https://geb.sts.nt.uni-siegen.de/doxy/aotus/): Library that provides a Fortran wrapper to use Lua scripts as configuration files (MIT).\n* [FortLua](https://github.com/adolgert/FortLua): Example that shows how to load Lua configuration files from Fortran, based on AOTUS (MIT).\n* [fortran-lua53](https://github.com/interkosmos/fortran-lua53): Fortran 2008 bindings to Lua 5.3 (ISC).\n* [f2k3-lua](https://github.com/MaikBeckmann/f2k3-lua): Lua bindings for loading configuration files only (MIT).\n* [luaf](https://bitbucket.org/vadimz/luaf/): Selected bindings to Lua 5.1 (MIT).\n\n## Build Instructions\n\nInstall Lua 5.4 with development headers. On FreeBSD, run:\n\n```\n# pkg install devel/pkgconf lang/lua54\n```\n\nOn Debian Linux, install:\n\n```\n# apt-get install pkg-config liblua5.4 liblua5.4-dev\n```\n\nUse [xmake](https://github.com/xmake-io/xmake) to build *fortran-lua54*:\n\n```\n$ xmake\n```\n\nThis outputs `libfortran-lua54.a` and `lua.mod` to `build/`. Without xmake, just\ncompile and install the library using the provided `Makefile`:\n\n```\n$ make\n$ make install PREFIX=/opt\n```\n\nOr, run the Fortran Package Manager:\n\n```\n$ fpm build --profile release\n```\n\nLink your Fortran applications against `libfortran-lua54.a`, and `liblua-5.4.a`\nor `-llua54`. On Linux, you have to link against `liblua5.4.a` or `-llua5.4`\nrespectively instead. The include and library search paths may differ as well.\n\n## Example\n\nThe following basic example shows how to call the Lua function `hello()` in\n`script.lua` from Fortran.\n\n```lua\n-- script.lua\nfunction hello()\n    print('Hello from Lua!')\nend\n```\n\nMake sure that `script.lua` is stored in the same directory as the Fortran\napplication.\n\n```fortran\n! example.f90\nprogram main\n    use, intrinsic :: iso_c_binding\n    use :: lua\n    implicit none\n\n    type(c_ptr) :: l\n    integer     :: rc\n\n    l = lual_newstate()\n    call lual_openlibs(l)\n\n    rc = lual_dofile(l, 'script.lua')\n    rc = lua_getglobal(l, 'hello')\n    rc = lua_pcall(l, 0, 0, 0)\n\n    call lua_close(l)\nend program main\n```\n\nIf the the interface bindings are installed to `/opt`, then compile,\nlink, and run the example with:\n\n```\n$ gfortran -I/opt/include/libfortran-lua54/ -L/usr/local/lib/lua/5.4/ \\\n  -o example example.f90 /opt/lib/libfortran-lua54.a -llua-5.4\n$ ./example\nHello from Lua!\n```\n\nOn Linux, change the prefix `/usr/local` to `/usr`. To link Lua 5.4 statically,\nrun instead:\n\n```\n$ gfortran -o example example.f90 libfortran-lua54.a /usr/local/lib/liblua-5.4.a\n```\n\n## Further Examples\n\nAdditional examples can be found in `examples/`.\n\n* **fibonacci:** calls a recursive Lua routine loaded from file.\n* **library:** calls a Fortran routine inside a shared library from Lua (copy\n  `fortran.so` to `share/`, then run `share/library.lua`).\n* **string:** runs Lua code stored in a Fortran string.\n* **table:** reads values from a Lua table.\n\n## Fortran Package Manager\n\nYou can add *fortran-lua54* as an [FPM](https://github.com/fortran-lang/fpm)\ndependency:\n\n```toml\n[dependencies]\nfortran-lua54 = { git = \"https://github.com/interkosmos/fortran-lua54.git\" }\n```\n\n## Compatibility\n\nThe integer and float types used by Lua internally depend on the targeted\nplatform. The program `test/types.c` outputs the types:\n\n```\n$ make test\n$ ./types\nlua_integer.: c_long_long\nlua_number..: c_double\nlua_kcontext: c_intptr_t\n```\n\nYou may have to alter `lua_integer`, `lua_number`, and `lua_kcontext` in\n`src/lua.f90` accordingly.\n\n## Coverage\n\n| Function Name           | Fortran Interface Name  | Bound | Wrapper |\n|-------------------------|-------------------------|-------|---------|\n| `luaL_addchar`          |                         |       |         |\n| `luaL_addlstring`       |                         |       |         |\n| `luaL_addsize`          |                         |       |         |\n| `luaL_addstring`        |                         |       |         |\n| `luaL_addvalue`         |                         |       |         |\n| `luaL_argcheck`         |                         |       |         |\n| `luaL_argerror`         |                         |       |         |\n| `luaL_buffinit`         |                         |       |         |\n| `luaL_buffinitsize`     |                         |       |         |\n| `luaL_callmeta`         |                         |       |         |\n| `luaL_checkany`         |                         |       |         |\n| `luaL_checkinteger`     |                         |       |         |\n| `luaL_checklstring`     |                         |       |         |\n| `luaL_checknumber`      |                         |       |         |\n| `luaL_checkoption`      |                         |       |         |\n| `luaL_checkstack`       |                         |       |         |\n| `luaL_checkstring`      |                         |       |         |\n| `luaL_checktype`        |                         |       |         |\n| `luaL_checkudata`       |                         |       |         |\n| `luaL_checkversion`     |                         |       |         |\n| `luaL_dofile`           | `lual_dofile`           |   ✓   |         |\n| `luaL_dostring`         | `lual_dostring`         |   ✓   |         |\n| `luaL_error`            |                         |       |         |\n| `luaL_execresult`       |                         |       |         |\n| `luaL_fileresult`       |                         |       |         |\n| `luaL_getmetafield`     |                         |       |         |\n| `luaL_getmetatable`     |                         |       |         |\n| `luaL_getsubtable`      |                         |       |         |\n| `luaL_gsub`             |                         |       |         |\n| `luaL_len`              | `lual_len`              |   ✓   |         |\n| `luaL_loadbufferx`      |                         |       |         |\n| `luaL_loadfile`         | `lual_loadfile`         |   ✓   |         |\n| `luaL_loadfilex`        | `lual_loadfilex`        |   ✓   |         |\n| `luaL_loadstring`       | `lual_loadstring`       |   ✓   |    ✓    |\n| `luaL_newlib`           |                         |       |         |\n| `luaL_newlibtable`      |                         |       |         |\n| `luaL_newmetatable`     |                         |       |         |\n| `luaL_newstate`         | `lual_newstate`         |   ✓   |         |\n| `luaL_openlibs`         | `lual_openlibs`         |   ✓   |         |\n| `luaL_opt`              |                         |       |         |\n| `luaL_optinteger`       |                         |       |         |\n| `luaL_optlstring`       |                         |       |         |\n| `luaL_optnumber`        |                         |       |         |\n| `luaL_optstring`        |                         |       |         |\n| `luaL_prepbuffer`       |                         |       |         |\n| `luaL_prepbuffsize`     |                         |       |         |\n| `luaL_pushresult`       |                         |       |         |\n| `luaL_pushresultsize`   |                         |       |         |\n| `luaL_ref`              |                         |       |         |\n| `luaL_register`         |                         |       |         |\n| `luaL_requiref`         |                         |       |         |\n| `luaL_setfuncs`         |                         |       |         |\n| `luaL_setmetatable`     |                         |       |         |\n| `luaL_testudata`        |                         |       |         |\n| `luaL_tolstring`        |                         |       |         |\n| `luaL_traceback`        |                         |       |         |\n| `luaL_typename`         |                         |       |         |\n| `luaL_unref`            |                         |       |         |\n| `luaL_where`            |                         |       |         |\n| `lua_absindex`          |                         |       |         |\n| `lua_arith`             | `lua_arith`             |   ✓   |         |\n| `lua_atpanic`           |                         |       |         |\n| `lua_call`              | `lua_call`              |   ✓   |         |\n| `lua_callk`             | `lua_callk`             |   ✓   |         |\n| `lua_checkstack`        | `lua_checkstack`        |   ✓   |         |\n| `lua_close`             | `lua_close`             |   ✓   |         |\n| `lua_compare`           | `lua_compare`           |   ✓   |         |\n| `lua_concat`            | `lua_concat`            |   ✓   |         |\n| `lua_copy`              | `lua_copy`              |   ✓   |         |\n| `lua_createtable`       | `lua_createtable`       |   ✓   |         |\n| `lua_dump`              |                         |       |         |\n| `lua_error`             |                         |       |         |\n| `lua_gc`                | `lua_gc`                |   ✓   |         |\n| `lua_getallocf`         |                         |       |         |\n| `lua_getextraspace`     |                         |       |         |\n| `lua_getfield`          | `lua_getfield`          |   ✓   |    ✓    |\n| `lua_getglobal`         | `lua_getglobal`         |   ✓   |    ✓    |\n| `lua_geti`              |                         |       |         |\n| `lua_getmetatable`      |                         |       |         |\n| `lua_gettable`          |                         |       |         |\n| `lua_gettop`            | `lua_gettop`            |   ✓   |         |\n| `lua_getuservalue`      |                         |       |         |\n| `lua_insert`            |                         |       |         |\n| `lua_isboolean`         | `lua_isboolean`         |   ✓   |         |\n| `lua_iscfunction`       | `lua_iscfunction`       |   ✓   |         |\n| `lua_isfunction`        | `lua_isfunction`        |   ✓   |         |\n| `lua_isinteger`         | `lua_isinteger`         |   ✓   |         |\n| `lua_islightuserdata`   |                         |       |         |\n| `lua_isnil`             | `lua_isnil`             |   ✓   |         |\n| `lua_isnone`            | `lua_isnone`            |   ✓   |         |\n| `lua_isnoneornil`       | `lua_isnoneornil`       |   ✓   |         |\n| `lua_isnumber`          | `lua_isnumber`          |   ✓   |         |\n| `lua_isstring`          | `lua_isstring`          |   ✓   |         |\n| `lua_istable`           | `lua_istable`           |   ✓   |         |\n| `lua_isthread`          | `lua_isthread`          |   ✓   |         |\n| `lua_isuserdata`        | `lua_isuserdata`        |   ✓   |         |\n| `lua_isyieldable`       | `lua_isyieldable`       |   ✓   |         |\n| `lua_len`               |                         |       |         |\n| `lua_load`              | `lua_load`              |   ✓   |         |\n| `lua_newstate`          |                         |       |         |\n| `lua_newtable`          | `lua_newtable`          |   ✓   |         |\n| `lua_newthread`         |                         |       |         |\n| `lua_newuserdata`       |                         |       |         |\n| `lua_next`              |                         |       |         |\n| `lua_numbertointeger`   |                         |       |         |\n| `lua_pcall`             | `lua_pcall`             |   ✓   |         |\n| `lua_pcallk`            | `lua_pcallk`            |   ✓   |         |\n| `lua_pop`               | `lua_pop`               |   ✓   |         |\n| `lua_pushboolean`       | `lua_pushboolean`       |   ✓   |         |\n| `lua_pushcclosure`      | `lua_pushcclosure`      |   ✓   |         |\n| `lua_pushcfunction`     |                         |       |         |\n| `lua_pushfstring`       |                         |       |         |\n| `lua_pushglobaltable`   |                         |       |         |\n| `lua_pushinteger`       | `lua_pushinteger`       |   ✓   |         |\n| `lua_pushlightuserdata` | `lua_pushlightuserdata` |   ✓   |         |\n| `lua_pushliteral`       |                         |       |         |\n| `lua_pushlstring`       | `lua_pushlstring`       |   ✓   |    ✓    |\n| `lua_pushnil`           | `lua_pushnil`           |   ✓   |         |\n| `lua_pushnumber`        | `lua_pushnumber`        |   ✓   |         |\n| `lua_pushstring`        | `lua_pushstring`        |   ✓   |    ✓    |\n| `lua_pushthread`        | `lua_pushthread`        |   ✓   |         |\n| `lua_pushvalue`         | `lua_pushvalue`         |   ✓   |         |\n| `lua_pushvfstring`      |                         |       |         |\n| `lua_rawequal`          |                         |       |         |\n| `lua_rawget`            | `lua_rawget`            |   ✓   |         |\n| `lua_rawgeti`           | `lua_rawgeti`           |   ✓   |         |\n| `lua_rawgetp`           |                         |       |         |\n| `lua_rawlen`            | `lua_rawlen`            |   ✓   |         |\n| `lua_rawset`            | `lua_rawset`            |   ✓   |         |\n| `lua_rawseti`           | `lua_rawseti`           |   ✓   |         |\n| `lua_rawsetp`           |                         |       |         |\n| `lua_register`          | `lua_register`          |   ✓   |         |\n| `lua_remove`            |                         |       |         |\n| `lua_replace`           |                         |       |         |\n| `lua_resume`            |                         |       |         |\n| `lua_rotate`            |                         |       |         |\n| `lua_setallocf`         |                         |       |         |\n| `lua_setfield`          | `lua_setfield`          |   ✓   |    ✓    |\n| `lua_setglobal`         | `lua_setglobal`         |   ✓   |    ✓    |\n| `lua_seti`              | `lua_seti`              |   ✓   |         |\n| `lua_setmetatable`      |                         |       |         |\n| `lua_settable`          | `lua_settable`          |   ✓   |         |\n| `lua_settop`            | `lua_settop`            |   ✓   |         |\n| `lua_setuservalue`      |                         |       |         |\n| `lua_status`            | `lua_status`            |   ✓   |         |\n| `lua_stringtonumber`    |                         |       |         |\n| `lua_toboolean`         | `lua_toboolean`         |   ✓   |    ✓    |\n| `lua_tocfunction`       |                         |       |         |\n| `lua_tointeger`         | `lua_tointeger`         |   ✓   |         |\n| `lua_tointegerx`        | `lua_tointegerx`        |   ✓   |         |\n| `lua_tolstring`         |                         |       |         |\n| `lua_tonumber`          | `lua_tonumber`          |   ✓   |         |\n| `lua_tonumberx`         | `lua_tonumberx`         |   ✓   |         |\n| `lua_topointer`         |                         |       |         |\n| `lua_tostring`          | `lua_tostring`          |   ✓   |         |\n| `lua_tothread`          |                         |       |         |\n| `lua_touserdata`        |                         |       |         |\n| `lua_type`              | `lua_type`              |   ✓   |         |\n| `lua_typename`          | `lua_typename`          |   ✓   |    ✓    |\n| `lua_upvalueindex`      |                         |       |         |\n| `lua_version`           | `lua_version`           |   ✓   |         |\n| `lua_xmove`             |                         |       |         |\n| `lua_yield`             |                         |       |         |\n| `lua_yieldk`            |                         |       |         |\n\n## Licence\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-lua54","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterkosmos%2Ffortran-lua54","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-lua54/lists"}