[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: method overloading?
- From: PA <petite.abeille@...>
- Date: Mon, 31 Jan 2005 00:59:16 +0100
Hello,
What's the accepted practice to somehow "overload" methods in Lua?
Presently, I'm using the type() function to more or less achieve the
same effect.
For example, the following method accepts either a "number" or
something else and act accordantly:
local function get( anIndex )
if type( anIndex ) ~= "number" then
anIndex = indexOf( anIndex )
end
return ivars[ anIndex ]
end
Is that a reasonable approach? Alternatives?
Thanks!
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/