Orbiter icon indicating copy to clipboard operation
Orbiter copied to clipboard

fixed minor typos that affect Darwin/Linux OS users of Orbiter

Open likethesky opened this issue 12 years ago • 2 comments

Darwin users get the following when they try to use Orbiter: $ lua hello.lua --launch Orbiter serving on http://localhost:8080 lua: /usr/local/share/lua/5.1/orbiter/init.lua:115: attempt to perform arithmetic on a string value stack traceback: /usr/local/share/lua/5.1/orbiter/init.lua:115: in function 'which' /usr/local/share/lua/5.1/orbiter/init.lua:132: in function 'launch_browser' /usr/local/share/lua/5.1/orbiter/init.lua:448: in function 'run' hello.lua:23: in main chunk [C]: ? Wrong variable used. A global no less -- using strict.lua would have caught this for you!

These two fixes correct the above for Darwin users (by changing 'line' to 'os') and a similar issue for Linux users (by changing the mod '%' operation to a more Lua-like string concatenation.

likethesky avatar Aug 17 '12 17:08 likethesky

Damn global variables! Orbit did not like strict.lua, so I got out of the habit.

The % is actually an overload supported elsewhere in the framework that supports Python-style string formatting, but I've become suspicious of it - e.g. your first reaction was to say 'mistake'. But your fix won't work unless you replace the ',' with '..':

    return shell ('which '..%s..' 2> /dev/null')

Much more straightforward, I agree!

steve d.

stevedonovan avatar Aug 18 '12 09:08 stevedonovan

Yes, I'd just been reading about how print(a,b,c) is much more efficient than print(a..b..c) and I got carried away. This is a call to shell(), not to print()!!

Fixed.

UPDATE: PS I'd realized when I originally make the fix that you were "thinking" you had the Python-style here, but of course you don't, right? Or are you using Orbiter to run Orbiter? Not sure which framework you're referring to.

likethesky avatar Aug 19 '12 18:08 likethesky