From: John L. <jla...@gm...> - 2006-08-28 15:29:25
|
On 8/28/06, hel...@gm... <hel...@gm...> wrote: > is it by design, that during pre-compilation the existence of funtions (or the correctness of function names) is not checked? > > Any mistyped function name is just discovered at runtime and leads to a "error running chunk" message. > > I would rather expect that the function names are checked sooner, so that any mistyped function (not declared or defined with RegisterFunction) is reported during pre-compilation. I do not think that this is possible or would be overly complicated. In fact lua itself doesn't do this itself. However if you know how please suggest a way to do this. There was a lua lint program somewhere that may be useful. Try this simple program: a = math.sin(1) b = math.si(2) $ ./lua5.1.exe precomp_test.lua d:\wxCVS\wxLua\wxLua\bin\lua5.1.exe: precomp_test.lua:2: attempt to call field 'si' (a nil value) stack traceback: precomp_test.lua:2: in main chunk [C]: ? It doesn't check that I've mistyped "math.sin" for line 2 until it's run. However try this: a = math.sin(1) b = 1math.si(2) $ ./lua5.1.exe precomp_test.lua d:\wxCVS\wxLua\wxLua\bin\lua5.1.exe: precomp_test.lua:2: malformed number near '1math' It does check for gross syntax errors. Regards, John Labenski |