3.4.1.0.2 Lua 4

LuaCOM

next up previous contents Next: 3.4.2 Pointers to IDispatch Up: 3.4.1 Boolean values Previous: 3.4.1.0.1 Lua 5   Contents

3.4.1.0.2 Lua 4

This version of Lua uses the nil value as false and non-nil values as true. As LuaCOM gives a special meaning for nil values in the parameter list, it can't use Lua convention for true and false values; instead, LuaCOM uses the C convention: the true value is a number different from zero and the false value is the number zero. Here follows a sample:

-- This function alters the state of the of the window.
-- state is a Lua boolean value
-- window is a LuaCOM object
function showWindow(window, state)
  if state then
    window.Visible = 1
    -- this has the same result
    windows.Visible = -10
  else
    window.Visible = 0
  end
end
-- Shows window
showWindow(window, 1)
-- Hides window
showWindow(window, nil)



Fabio Mascarenhas de Queiroz 2005-01-07