Search found 3 matches

by nobody
Sat Apr 18, 2015 11:12 pm
Forum: Support and Development
Topic: cross version compatible module definition
Replies: 14
Views: 4592

Re: cross version compatible module definition

Aha! I forgot that the 1st parameter on setfenv referred to the current function, though how would a 5.2 polyfill cope with it?… My setfenv -reimplementation checks what arg#1 is and if it's a number (=stack level), then it uses debug.getinfo( lvl, "f" ).func as the function. (Plus rather...
by nobody
Sat Apr 18, 2015 9:58 pm
Forum: Support and Development
Topic: cross version compatible module definition
Replies: 14
Views: 4592

Re: cross version compatible module definition

Is checking for setfenv enough to discover 5.1? No. Quite a few people define setfenv / getfenv as compatibility functions (or use modules that provide these.) (Not terribly many, but if you do this, it'll probably break for someone eventually.) (OTOH, if you do stuff that doesn't break if someone ...
by nobody
Tue Dec 16, 2014 1:50 am
Forum: Support and Development
Topic: How to rename dir / move file?
Replies: 20
Views: 11603

Re: How to rename dir / move file?

In that case, can you explain so I don't make this mistake again? (unixoid examples only:) simplified core of that example code: os.execute( table.concat( {command, " \"", old, "\" \"", new, "\""} ) ) or (equally bad but more readable): os.execute( ...