Skip to content
Portable Lua C-API binding using Fortran 2003's ISO_C_BINDING module.
Find file
Pull request Compare This branch is 22 commits ahead, 1 commit behind master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

f2k3 lua bindings - simple

What is meant by `simple’?

This API provided in the `simple’ branch of f2k3-lua is meant to serve the needs of using lua a language for configuration files and nothing else.

What can I do with it?

After the configuration file was executed, you can query for variables that hold the following data types

  • strings
  • numbers
  • Tables that are composed using numbers and strings

Build instructions

Configure, build and install f2k3-lua-simple

mkdir build && cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/tmp/f2k3_test
make install

What do we need to build this package: CMake, a C compiler and a fortran compiler that supports enough f2k3.

Configure and build your own software

If you use cmake, your CMakeLists.txt looks roughly like this

cmake_minimum_required(VERSION 2.6)
project(foo C Fortran)

find_package(f2k3_lua_simple REQUIRED)


add_executable(foo test.f90)
target_link_libraries(foo ${f2k3_lua_simple_LIBRARIES})

You can build it now via

mkdir build && cd build
cmake ../ -DCMAKE_PREFIX_PATH=/tmp/f2k3_test

CMAKE_PREFIX_PATH tells cmake where to look for f2k3_lua_simple.

Common build errors

When you configure f2k3 itself and it can’t find lua, then this it tells you

CMake Error at
  (MESSAGE): Could NOT find Lua51 (missing: LUA_LIBRARIES
  LUA_INCLUDE_DIR) Call Stack (most recent call first):
  (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:4 (find_package

If your own cmake build script can’t find f2k3_lua_simple, then this is what cmake tells you

CMake Error at CMakeLists.txt:4 (find_package):
  Could not find module Findf2k3_lua_simple.cmake or a configuration file for
  package f2k3_lua_simple.

  Adjust CMAKE_MODULE_PATH to find Findf2k3_lua_simple.cmake or set
  f2k3_lua_simple_DIR to the directory containing a CMake configuration file
  for f2k3_lua_simple.  The file will have one of the following names:


What is it licensed under?

MIT, see the LICENSE file

The TODO list

  • docs
  • docs
  • guess what?
Something went wrong with that request. Please try again.