lua-users home
lua-l archive

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


--what about such a redefine:
 -- redefine `readfrom'
 function readfrom (name)
   return %readfrom(some_root_path..name)   -- call the original `readfrom' with root path prepended to a name
 end

> The "standard" technique is to redefine the open functions. Something
> like the following:
> 
> -- redefine `readfrom'
> function readfrom (name)
>   if not isOk(name) then
>     error("cannot open file " .. name)
>   end
>   return %readfrom(name)   -- call the original `readfrom'
> end
> 
>    ...  -- the same for writeto, etc.
> 
> -- Roberto
>