Commits

Harald Klimach committed 398dff1

Added pushboolean to the flu_binding

Comments (0)

Files changed (2)

LuaFortran/flu_binding.f90

   public :: flu_todouble
   public :: flu_tolstring, flu_tonumber, flu_toboolean
   public :: flu_pop
-  public :: flu_pushinteger, flu_pushnil, flu_pushnumber
+  public :: flu_pushinteger, flu_pushnil, flu_pushnumber, flu_pushboolean
   public :: flu_pushvalue
 
-  public :: fluL_loadfile, fluL_newstate, fluL_openlibs, fluL_loadstring
-  public :: fluL_loadbuffer
   public :: flu_copyptr
   public :: flu_register
 
   public :: flu_dump
 
+  public :: fluL_loadfile, fluL_newstate, fluL_openlibs, fluL_loadstring
+  public :: fluL_loadbuffer
+
   interface flu_pushnumber
     module procedure flu_pushreal
     module procedure flu_pushdouble
     call lua_pushinteger(L%state, n_c)
   end subroutine flu_pushinteger
 
+  subroutine flu_pushboolean(L, b)
+    type(flu_State) :: L
+    logical :: b
+
+    integer(kind=lua_int) :: n_c
+
+    if (b) then
+      n_c = 1_lua_int
+    else
+      n_c = 0_lua_int
+    end if
+    call lua_pushboolean(L%state, n_c)
+  end subroutine flu_pushboolean
+
   subroutine flu_pushreal(L, n)
     type(flu_State) :: L
     real :: n

LuaFortran/lua_fif.f90

       integer(kind=lua_int), value :: n
     end subroutine lua_pushinteger
 
+    subroutine lua_pushboolean(L, n) bind(c, name="lua_pushboolean")
+      use, intrinsic :: iso_c_binding
+      use lua_parameters, only: lua_int
+      type(c_ptr), value :: L
+      integer(kind=lua_int), value :: n
+    end subroutine lua_pushboolean
+
     subroutine lua_pushnil(L) bind(c, name="lua_pushnil")
       use, intrinsic :: iso_c_binding
       type(c_ptr), value :: L