[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Calling overloaded original functions
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 8 May 2008 17:38:34 -0300
> i am trying to extend the tostring function to do something special
> for my own special use tables. I found some example using the syntax
> below:
>
> function tostring(a)
> -- do something for special tables ...
> -- otherwise call original function:
> return %tostring(a)
> end
>
> But this gives me an error for the % character. Omiting the % results in an
> endless loop for obvious reasons ...
>
> How is this done?
local oldtostring = tostring
function tostring(a)
-- do something for special tables ...
-- otherwise call original function:
return oldtostring(a)
end
-- Roberto