Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

likethesky
Copy link

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.

@stevedonovan
Copy link
Owner

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.

@likethesky
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants