lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Tue, Oct 12, 2010 at 2:54 PM, steve donovan
<> wrote:
> local res,err = dofile(modpath)
> if not res then print(err) end

If you replace that with:

local f =,'r')
local body = f:read '*a'
if body:find '^#!' then
  local idx = body:find '\n'
  body = body:sub(idx)
local res,err = loadstring(body)
if not res then print(err) end

then things work as expected, but notice the ugly/inefficient hack
needed to strip the hash-bang line that chokes loadstring...

steve d.