Difference between revisions of "User:Kebap"

From Mudlet
Jump to navigation Jump to search
(+1)
(→‎Projects: display Mudlet version picture thumbnail)
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
* [[User:Kebap/documentation-in-wiki]] - currently on hold
 
* [[User:Kebap/documentation-in-wiki]] - currently on hold
 +
** Standardize layout of [[Manual:Lua_Functions]] in [[Area 51]]
  
 
* [[User:Kebap/translation infrastructure|Establish translation-infrastructure for Mudlet universe]]
 
* [[User:Kebap/translation infrastructure|Establish translation-infrastructure for Mudlet universe]]
Line 21: Line 22:
  
 
* Graphical overview of [[User:Kebap/Release dates|Release dates]]
 
* Graphical overview of [[User:Kebap/Release dates|Release dates]]
 +
[[File:Release_dates.png|thumb]]
  
 
* Add MorgenGrauen to Mudlet MUDs
 
* Add MorgenGrauen to Mudlet MUDs
Line 43: Line 45:
 
* Learn more [[User:Kebap/git commands|git commands]]
 
* Learn more [[User:Kebap/git commands|git commands]]
  
= Examples for Wiki formatting =
+
= Examples for formatting =
  
==functionName==
+
== API documentation ==
;functionName(arg1, arg2, [optionalArg3])
 
: What the function does. In this case, it is just a non-existing function with the only purpose to show, how to write documentation for functions
 
  
See also:
+
Examples and description moved to [[Area 51]] plus template linked from there
[[Manual:Lua_Functions#copy|copy]],
 
[[Manual:Lua_Functions#paste|paste]]
 
  
{{note}} This is an important information
+
== Standardized error messages in code ==
  
{{MudletVersion|3.5}}
+
Old style, not very informative:
 +
<syntaxhighlight lang="cpp">
 +
    if (!lua_isnumber(L, 1)) {
 +
        lua_pushstring(L, "createMapLabel: wrong argument type");
 +
        return lua_error(L);
 +
    }
 +
    int area = lua_isnumber(L, 1);
 +
</syntaxhighlight>
  
;Parameters
+
New style with additional information:
* arg1:
+
<syntaxhighlight lang="cpp">
: What arg1 is/does. Passed as a string.
+
    if (!lua_isnumber(L, 1)) {
* arg2:
+
        lua_pushfstring(L,
: What arg2 is/does. Passed as a string.
+
                "createMapLabel: bad argument #1 type (areaID as number expected, got %s!)",
* ''optionalArg3''
+
                luaL_typename(L, 1));
: (optional) The name needn't be telling. Relevant is to mark optional arguments at the start of this line (with text "optional" in brackets) and in the function definition line (with [these] brackets)
+
        return lua_error(L);
 
+
    }
;Returns
+
    int area = lua_tointeger(L, 1);
* whatever the function returns.
 
 
 
;Example
 
<syntaxhighlight lang="lua">
 
--a small example snippet of the function in action
 
--the comments up top should introduce it/explain what the snippet does
 
functionName("arg1", "arg2")
 
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 23:03, 15 November 2022

About me

Mudlet user and script developer, hailing from MorgenGrauen (German).

Projects

Release dates.png
  • Enable Discord group "Testers" to (de-)register themselves via Discord reactions done! :)
  • Learn how to make small PR like above with Smart Git instead of github web interface done! :)
Me with a few buddies
  • Improve Mudlet documentation, which is not interesting for Mudlet users, but only for (some) developers.
    • Including definitions on internal functions,
    • discussions and decisions on coding style conventions,
    • standard procedures like Release Checklist, update lua function list for autocompletion,
    • This is done by adding Categories like "Mudlet Developer Manual" or "Mudlet Admin Manual"
    • etc.
  • Look into improving a11y (accessibility) of Mudlet client and website, etc.

Examples for formatting

API documentation

Examples and description moved to Area 51 plus template linked from there

Standardized error messages in code

Old style, not very informative:

    if (!lua_isnumber(L, 1)) {
        lua_pushstring(L, "createMapLabel: wrong argument type");
        return lua_error(L);
    }
    int area = lua_isnumber(L, 1);

New style with additional information:

    if (!lua_isnumber(L, 1)) {
        lua_pushfstring(L,
                "createMapLabel: bad argument #1 type (areaID as number expected, got %s!)",
                luaL_typename(L, 1));
        return lua_error(L);
    }
    int area = lua_tointeger(L, 1);