Useful Lua Modules Not Included By Default

The Feko installation also includes a number of modules that are not included by default with all Lua distributions, but are useful for many scripting applications

Although these modules are included as part of the installation, they still need to be loaded or required when the are used in a script. Modules are included in a script by using the require command.
require( ' luacom ' )
The modules available as part of the Feko installation includes the following:
LuaCOM

The Feko installation (Windows paltform) includes the LuaCOM module. The LuaCOM module allows users to control applications that follow Microsoft’s Component Object Model (COM) specification. The following two examples illustrate how LuaCOM is used to control Microsoft Excel. These examples require a compatible version of Excel to be installed. For more information regarding the COM interface for Microsoft Office components, consult the object model references available at the Microsoft MSDN1 website.

-- COM example 1
require( ' luacom ' )
excel = luacom.CreateObject("Excel.Application")
excel.Visible = true
wb = excel.Workbooks:Add()
ws = wb.Worksheets(1)
for i=1, 20 do
ws.Cells(i,1).Value2 = i
end
-- COM example 2
require "luacom"
excel = luacom.CreateObject("Excel.Application")
local book = excel.Workbooks:Add()
local sheet = book.Worksheets(1)
excel.Visible = true
for row=1, 30 do
sheet.Cells(row, 1).Value2 = math.floor(math.random() * 100)
end
local chart = excel.Charts:Add()
chart.ChartType = 4
local range = sheet:Range("A1:A30")
chart:SetSourceData(range)
LuaFileSystem
LuaFileSystem offers a portable way to access the underlying directory structure and file attributes. The module name that needs to be included is “ lfs ”.
LuaXml
LuaXML provides a minimal set of functions for the processing of XML data. The module name that needs to be included is “ luaxml ”.
PenLight
The PenLight module is a collection of common lua code patterns for tables, arrays, strings, paths and directories, data, and functional programming. The module name that needs to be included is “ pl ”.
winapi
This module provides some basic tools for working with Windows systems such as accessing the registry, finding out system resources, and gives you more control over process creation.