lua-users home
lua-l archive

local functions revisited

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


Would it be possible to enable the syntax:
	local function myFunc(params)
I would like to use the ':' sugar for class methods:
	function MyClass:myFunc(params)
But private methods need to use the form:
	local privateFunc = function(params)
And I don't want to try and convince scripters to use two different forms, so my class methods end up:
	MyClass.myFunc = function(self, params)
which isn't *that* bad, and I'll admit this is all just personal preference from someone with a C background, but it would be nice to have a 'local function f()' to go with 'function f()'. I assume that there is some technical limitation involved, or this would have been done already.
Jason
379

AltStyle によって変換されたページ (->オリジナル) /