Add proper lua api deprecated handling
Fix usage of deprecated functions in builtin