Lua: Various improvements

Some stuff requested by R00Kie.