Why does LUA suck

Post Reply
holypickle
Posts: 10
Joined: Sun Feb 14, 2016 1:06 pm

Why does LUA suck

Post by holypickle » Sun Mar 13, 2016 11:01 am

There's no comprehensive resources for learning LUA or Mudlet as far as I can see. I don't know a ding-dang thing about LUA or programming, so wat do!?

User avatar
SlySven
Posts: 920
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Why does LUA suck

Post by SlySven » Mon Mar 14, 2016 10:49 am

May I refer you to the fine manuals {"fine" as in Read The Fine Manuals} for Lua and for Mudlet (the latter of which is available from that link labelled Wiki up in the top right corner of this web-page)? :ugeek:

User avatar
Vadi
Posts: 4721
Joined: Sat Mar 14, 2009 3:13 pm

Re: Why does LUA suck

Post by Vadi » Sat Mar 26, 2016 3:20 am


User avatar
SlySven
Posts: 920
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Why does LUA suck

Post by SlySven » Mon Mar 28, 2016 1:33 am

On the other hand - I've just gotten bitten in the behind by Lua!

For those of you who don't know (but do care), I'm happiest hacking away in the C++ at the core of the Mudlet application, and I have over the last couple of years pushed some new/extra bits into the Lua subsystem in the part that talks directly to the Mudlet C++ code.

This provides a fair few of the Lua commands that you can utilise in scripts and other elements in the editor and directly in the console input line after starting your entry with the magic word (well actually it is an Alias ;) ) "lua " if you have the "run-lua-code-v4" package loaded and enabled in your Alias. It is by default.

Unfortunately what I had forgotten is the included/supplied Mudlet/Geyser Lua script package that is included as part of the whole caboodle - this is loaded into Mudlet's lua interpreter when a profile is loaded in (the line that should result in a "[ OK ] - Mudlet-lua API & Geyser Layout manager loaded." message in the current bleeding edge code. Failure to find these files (particularly the luaGlobal.lua file which is what loads all the other) is one of the things that people building from source sometimes find an issue after they have successfully compiled the source code into a Mudlet executable - the application runs but will moan and not work as expected if it can't find the files after it has started to load a profile.

Anyhow the lua scripts in those files do provide some (a lot) of lua commands (functions) that act as wrappers around the core that I have been working on - and many of them happen to have the same name and as they are loaded in after the code that I have been slaving over they get used in preference as I understand it. I.e. if you do not like how a built in lua function works you can write your own that will get used instead but if you do so you had better makes sure it at least emulates the command it replaces...! :geek:

tl;dr; some improvements to some built-in commands (ability to use string "west" instead of number 3) as the "direction" in setExit( fromRoomId, toRoomId, direction ) was being lost in the function with the same name in the Other.lua file which only accepts the string "w" or 3 as meaning the west direction - to be honest the ability to parse a wider range of names for each direction was not my code/baby otherwise I might have spotted this more quickly but I was mystified why a test scripts I was creating to create a small map automagically to check some work would not create the wanted exits between the rooms it had made; it was because the semi-"invisible" (to me) included external lua stuff was knobble-ling the commands I was using - before they got to the C++ code I was trying to debug- {in TLuaInterpreter.cpp in the Qt IDE}... Grrrrrr! :evil:

thesavage123
Posts: 2
Joined: Thu Jul 12, 2018 6:29 am

Re: Why does LUA suck

Post by thesavage123 » Thu Jul 12, 2018 9:48 am

Hope that helps.
[/quote]

Doesn’t help me. I have no idea why any of those things would be important. I don’t need lists of commands. I need someone to show or explain to me WHY you do those commands. For example: do these commands to make a box. Do this command to put things in the box. I don’t know... the amount of searching and looking for help is extremely disheartening. I want to learn, but can’t find a tutorial simple enough for me.

User avatar
Vadi
Posts: 4721
Joined: Sat Mar 14, 2009 3:13 pm

Re: Why does LUA suck

Post by Vadi » Thu Jul 12, 2018 4:44 pm

There's a tutorial on how to make boxes here, copy/paste the code: https://wiki.mudlet.org/w/Manual:Geyser

Jor'Mox
Posts: 1099
Joined: Wed Apr 03, 2013 2:19 am

Re: Why does LUA suck

Post by Jor'Mox » Thu Jul 12, 2018 5:12 pm

I can sympathize with how hard it can be to learn something like this yourself, particularly if there aren't tutorials covering what you think is actually important. What I can say, however, is that there are a number of people, myself included, who are willing to help with those sorts of issues. BUT, most of us have neither the time nor the mindset to create a full-blown tutorial covering more or less everything you might want to know to use LUA in Mudlet.

SO, I recommend making a post in the help section with a specific request, and asking for things to be spelled out as much as possible so you can learn from the code that people come up with. Start with something simple, like capturing chat messages into a window, or certain triggers or aliases to simplify/automate common tasks that you perform in game. Ask plenty of questions so you are sure you understand what is happening and why. Then progress to more complex tasks, like tracking affects or inventory, simple "scripts" in which more complex tasks are carried out in an automated fashion, like something to perform multi-step crafting, or a simple script to walk through an area and kill creatures to gather experience, etc. As things get more complicated, you will typically run into three different categories of problems. The first is simply needing to take advantage of unfamiliar functions that are available to use, some of which are more complicated to use than others. The second is needing to learn new coding strategies to more effectively and efficiently handle a new situation. And the third is figuring out how to keep track of what is happening as things get more complex so you can track down where problems arise.

xabre
Posts: 39
Joined: Thu Mar 08, 2012 7:19 pm

Re: Why does LUA suck

Post by xabre » Sun Jul 15, 2018 12:13 pm

Compared to what? I find Lua to be as easy or easier than other programming languages.
Even though it seems hard at first, I find Mudlet to be much easier for writing and using scripts compared to other MUD clients.
At least properly documented (with a lot of examples) plus a decently sized community.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests