{"id":18847835,"url":"https://github.com/interkosmos/fortran-lua53","last_synced_at":"2025-04-14T08:10:28.648Z","repository":{"id":42184915,"uuid":"239886854","full_name":"interkosmos/fortran-lua53","owner":"interkosmos","description":"Fortran 2008 interface bindings to Lua 5.3","archived":false,"fork":false,"pushed_at":"2023-09-26T20:48:24.000Z","size":83,"stargazers_count":18,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T21:46:40.412Z","etag":null,"topics":["fortran","fortran-package-manager","fpm","lua","lua53"],"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}},"created_at":"2020-02-11T23:34:11.000Z","updated_at":"2025-02-20T12:46:32.000Z","dependencies_parsed_at":"2023-09-24T12:52:41.263Z","dependency_job_id":"f9fadfe4-bde9-4542-b9f5-f95638f300b4","html_url":"https://github.com/interkosmos/fortran-lua53","commit_stats":{"total_commits":52,"total_committers":3,"mean_commits":"17.333333333333332","dds":0.09615384615384615,"last_synced_commit":"d0d684978e922bbc8c2f7e4be0cc901f80c29de6"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua53","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua53/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua53/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-lua53/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interkosmos","download_url":"https://codeload.github.com/interkosmos/fortran-lua53/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248843867,"owners_count":21170492,"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-package-manager","fpm","lua","lua53"],"created_at":"2024-11-08T03:09:50.158Z","updated_at":"2025-04-14T08:10:28.619Z","avatar_url":"https://github.com/interkosmos.png","language":"Fortran","readme":"# fortran-lua53\n\nA collection of ISO C binding interfaces to Lua 5.3 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-lua54](https://github.com/interkosmos/fortran-lua54): Fortran 2008 bindings to Lua 5.4 (ISC).\n* [f2k3-lua](https://github.com/MaikBeckmann/f2k3-lua/tree/simple): 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\n\nInstall Lua 5.3 with development headers. On FreeBSD, run:\n\n```\n# pkg install lang/lua53\n```\n\nOn Debian Linux, install:\n\n```\n# apt-get install liblua5.3 liblua5.3-dev\n```\n\nUse [xmake](https://github.com/xmake-io/xmake) to build *fortran-lua53*:\n\n```\n$ xmake\n```\n\nThis outputs `libfortran-lua53.a` and `lua.mod` to `build/`. Without xmake, just\ncompile the library using the provided `Makefile`:\n\n```\n$ make\n```\n\nOr, run the Fortran Package Manager:\n\n```\n$ fpm build --profile=release\n```\n\nLink your Fortran applications against `libfortran-lua53.a`, and\n`liblua-5.3.a` or `-llua53`. On Linux, you have to link against `liblua5.3.a` or\n`-llua5.3` respectively instead. The include and library search paths may differ\nas 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, only: c_ptr\n    use :: lua\n    implicit none\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\nCompile, (dynamically) link, and run the example with:\n\n```\n$ gfortran -I/usr/local/include/lua53/ -L/usr/local/lib/lua/5.3/ \\\n  -o example example.f90 libfortran-lua53.a -llua-5.3\n$ ./example\nHello from Lua!\n```\n\nOn Linux, change the prefix `/usr/local` to `/usr`. To link Lua 5.3 statically,\nrun instead:\n\n```\n$ gfortran -o example example.f90 libfortran-lua53.a /usr/local/lib/liblua-5.3.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.\n* **string:** runs Lua code stored in a Fortran string.\n* **table:** reads values from a Lua table.\n\n## fpm\n\nYou can add *fortran-lua53* as an [fpm](https://github.com/fortran-lang/fpm)\ndependency:\n\n```toml\n[dependencies]\nfortran-lua53 = { git = \"https://github.com/interkosmos/fortran-lua53.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`         |                         |       |         |\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`           |                         |       |         |\n| `lua_xmove`             |                         |       |         |\n| `lua_yield`             |                         |       |         |\n| `lua_yieldk`            |                         |       |         |\n\n## Licence\n\nISC\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-lua53","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterkosmos%2Ffortran-lua53","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-lua53/lists"}