Author Topic: Stealth Documentation  (Read 5631 times)

0 Members and 1 Guest are viewing this topic.

Offline slyoneTopic starter

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Stealth Documentation
« on: October 04, 2014, 11:07:20 AM »
0
Over the years, the EasyUO wiki has been a valuable resource.

Stealth has similar wiki with a function list, usage descriptions, and tutorials.

Here are a few of the links:
Stealth Documentation by Category
Stealth Alphabetical Function Listing

The wiki is editable by any user when logged into the site.

There is also a Russian version of the references which I think is mostly synchronized with the English version:
Stealth Documentation by Category [Russian]
Stealth Alphabetical Function Listing [Russian]

As discussed in Vlek's post about the Stealth Python Reference, much of the documentation refers to the Pascal usage.  In some cases in the wiki, both the Pascal and Python versions of functions are shown.

Started playing back at the Second Age

Offline slyoneTopic starter

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: Stealth Documentation
« Reply #1 on: October 04, 2014, 11:16:32 AM »
0
The Stealth embedded Python is documented with Python doc strings.  Below is a code snippet that will generate a listing of each of the functions and the other types and write it to a file.  It builds off of Boydon's recommendation in Vlek's post about Stealth Python Documentation.  This code works in Python 2.  I have not tested it in Python 3 but see no reason why it wouldn't run in Python 3.

Code: [Select]
# Stealth UO Client Import
import stealth

# Python Library Imports
import inspect
import subprocess

# Test Code
# print help(CreateComponent)
# print CreateComponent.__doc__

func_lines = []
other_lines = []

# Get a listing of the member attributes of the Stealth library
functiondict = inspect.getmembers(stealth)

# Loop over each member and get its type and description
for k, v in functiondict:
    cur_line = "%s:\t%s\n" % (k, v)
    cur_doc = inspect.getdoc(getattr(stealth, k))
    if cur_doc:
        cur_line += "\t" + cur_doc + "\n"
    else:
        cur_line += "\tNo description\n"

    if inspect.isbuiltin(getattr(stealth, k)):
        # If the current member is a function add it to func_lines
        func_lines.append(cur_line)
    else:
        # else add the member and description to other_lines
        other_lines.append(cur_line)

with open("stealth_member_listing.txt", "w") as fh:
    # Write the functions to the file first
    for line in func_lines:
        fh.write(line)
    # Then write the other members to the file
    for line in other_lines:
        fh.write(line)

# Show the file in notepad
subprocess.call(["notepad", "stealth_member_listing.txt"])


I find it helpful to generate this listing each time Stealth is updated to a new version.

Started playing back at the Second Age

Offline Boydon

  • Moderator
  • **
  • *****
  • Posts: 76
  • Activity:
    0%
  • Reputation Power: 3
  • Boydon has no influence.
  • Respect: +16
  • Referrals: 0
    • View Profile
Re: Stealth Documentation
« Reply #2 on: October 06, 2014, 05:19:33 AM »
0
Nice post. :)

If you have time and will I also reccomend you to update the official stealth Wiki. :P
Member of the Stealth development team.