eval.html 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <html>
  2. <head>
  3. <link href="../tutorial.css" rel="stylesheet" type="text/css">
  4. </head>
  5. <body>
  6. <div class="header">
  7. The NakedMud Tutorial :: Eval
  8. </div>
  9. <!-- content starts here -->
  10. <div class="content-wrap"><div class="content-body-wrap"><div class="content">
  11. <div class="head">Dir</div>
  12. <div class="info">
  13. NakedMud has a simple, but very valuable command called eval. It allows you to
  14. run a simple line of python code and view what it evaluates to.
  15. <pre class="code">
  16. def cmd_dir(ch, cmd, arg):
  17. if arg == "":
  18. ch.send("What python statement do you want to evaluate?")
  19. else:
  20. ret = eval(arg)
  21. ch.send("Evaluation: " + str(ret))
  22. </pre>
  23. </div>
  24. <!-- content ends here-->
  25. </div></div></div>
  26. <!-- navigation starts here -->
  27. <div class="nav-wrap"><div class="nav">
  28. <iframe src="nav.html" height="100%" width="100%" scrolling=no frameborder=0>
  29. </iframe>
  30. <!-- navigation ends here -->
  31. </div></div>
  32. <!--div class="footer">Edit Date: Nov 15, 2008. By Geoff Hollis</div-->
  33. </body>
  34. </html>