lua-users home
lua-l archive

Re: Detecting an "empty" script?

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


>I need to determine if a Lua script does something -- anything -- nor not.
I think this is similar to the halting problem, right?
>For example, this script does nothing:
>
>"function main(arg)
>
>end"
It sure does: it sets the global "main".
>Is there a way that Lua can be convinced to determine this for me? I'm
>thinking that once the script is compiled, one could quickly scan it for any
>"set" opcodes and such?
If you're worried only about variables being set, then you can easily parse
the output of luac -l, as etc/globals.lua does.
Does the script below do something?
	for i=1,10 do end
--lhf

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