Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Useful calculator Alias
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #30 on Wed 25 Aug 2010 05:32 AM (UTC) Amended on Wed 25 Aug 2010 05:33 AM (UTC) by Nick Gammon
|
| Message
|
David Haley said:
Just wait until people want to assign results to temporary variables... ;)
Well, you can't for a couple of reasons.
First there is a return statement, so if you try something like this:
You get this:
[string "Alias: "]:2: [string "return a=5"]:1: '<eof>' expected near '='
Second, because of the setfenv it is effectively sandboxed from the main script space, so you wouldn't be able to affect it anyway.
So my comment to that is, if you want to assign stuff, use Ctrl+I to do immediate evaluations of scripts.
But if you just want to evaluate an expression and print the result in a single, smooth, action, use the calculator. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #31 on Wed 25 Aug 2010 05:45 AM (UTC) Amended on Wed 25 Aug 2010 05:46 AM (UTC) by Twisol
|
| Message
| Assuming you have access to newproxy and the debug table - which the plugin-ified alias doesn't - you can get the environment of a newproxy() userdata, which is the global environment.
debug.getfenv(newproxy(false))
It's an interesting little jailbreak. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| David Haley
USA (3,881 posts) Bio
|
| Date
| Reply #32 on Wed 25 Aug 2010 02:12 PM (UTC) Amended on Wed 25 Aug 2010 02:30 PM (UTC) by David Haley
|
| Message
| | I know you can't assign to temporaries using the current system... that's why it was meant to be a joke based on what could be called feature creep on a simple math calculator. :-) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
116,612 views.
This is page 3, subject is 3 pages long:
1
2
3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top