lua-users home
lua-l archive

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


Have a look at luaprompt. That includes a pretty printer, luap_describe, I incorporated it into the software of the company I used to work for, don't think we ever found an issue.

Thanks,
Kevin

Sent from my iPhone

On 10 Oct 2016, at 21:31, Nagaev Boris <bnagaev@gmail.com> wrote:

On Mon, Oct 10, 2016 at 11:06 PM, Rena <hyperhacker@gmail.com> wrote:
On Mon, Oct 10, 2016 at 3:52 PM, Igor Ehrlich <iehrlich@iponweb.net> wrote:

And, overuse of brackets...
At this point I got really curious. Could you please be more precise?


I guess technically you don't need the brackets in statements like:

if (depth == 0) {
luasdorintf("%-5i | ", stackIndex);
} else {
luasdorintf("       ", stackIndex);
}

It could be written like:

if (depth == 0)
luasdorintf("%-5i | ", stackIndex);
else
luasdorintf("       ", stackIndex);

but IMO this is a stylistic choice, and I usually prefer the former, as it
prevents mistakes like:


if (depth == 0)
luasdorintf("%-5i | ", stackIndex);
else
luasdorintf("       ", stackIndex);
do_another_thing(); //oops, not conditional

Anyway, bikeshedding aside, it's been pointed out on this list before that
"public domain" isn't legally recognized in some parts of the world, and
you're better to use something like the MIT License (that Lua uses itself)
which gives the same effect without any potential hassle for those who want
to use it.

--
Sent from my Game Boy.

+1 for not omitting { and } in one-line if and else.

--


Best regards,
Boris Nagaev