Skip to content
Implemenation of 'ex' API - portable os and io extension functions
C Lua
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
cmake Updated lua macros
w32api fix win32 compiler warning - memcpy return unknown size
.travis.yml Updated travis hook
CMakeLists.txt New CMake macros
COPYRIGHT Correct email address.
Changelog initial checkin
INSTALL initial checkin
JUST initial checkin
Makefile initial checkin
README Correct email address.
TODO git-svn-id: 92337893-263… Correct email address. cmake: update dist.cmake, cleanup HAVE_POSIX_SPAWN
ex.def build: add CMakeLists.txt and related files
test.lua add basic tests


"ex" API implementation
Copyright 2007 Mark Edgar < medgar at gmail com >

-- Environment
os.getenv(name) -- get environment variable
os.setenv(name, value) -- set/unset environment variable
os.environ() -- returns a copy of the environment

-- File system
cwd = os.currentdir()

for entry in os.dir(pathname) do ; end
entry = os.dirent(pathname)
  entry is a table, containing at least the following keys:
  name: the filename
  type: "file" or "directory" or another implementation-defined string
  size: the file size in bytes

-- Locking and pipes
file ="filename", "w")
file:lock(mode, start, length) -- mode is "r" or "w", start and length are optional
file:unlock(start, length) -- start and length are optional
in, out = io.pipe()

-- Process control
os.sleep(seconds) -- sleep for (floating-point) seconds
os.sleep(interval, unit) -- sleep for interval/unit seconds
pid = os.spawn(filename, {args={}, env={}, stdin=file, stdout=file, stderr=file})
exitcode = pid:wait(pid)
Something went wrong with that request. Please try again.