29 Apr, 2014, Odoth wrote in the 1st comment:
Votes: 0
Hi all, frequent reader here but infrequent poster.
I began experimenting with embedding Lua at Aarchon exactly 1 year ago today.
Since then I have certainly learned a lot. I've done lots and lots of rework and reshuffle, but by now I feel pretty well about the implementation.

The initial goal was to allow Lua scripts as an improvement over the standard ROM mprogs (though still maintaining support for these). That goal was met, and along the way we also got these nifty features:
* Lua syntax highlighting in prog editor (with user configureability).
* Lua interpreter mode for immortals (great for debug, one off scripts, and just playing around).
* Lua commands.
* Running prog scripts from server side lua files.
* Security levels for game object methods and properties (get and set) as well as global functions. Not all builders need access to getarealist(), or should be able to set mob levels dynamically, for example.
* 'luaquery' command to query the game db and display results in a nice auto-formatted table.
e.g. luaquery room 'area.name|vnum|name' 'name:find("yellow")' spits out:
Quote
|are|vnum |name |
|Oz |13038 |Beginning of the Yellow Brick Road |
|Oz |13039 |Along the Yellow Brick Road |
|Oz |13040 |Along the Yellow Brick Road |
|Oz |13041 |A Fork in the Yellow Brick Road |
|Oz |13048 |Along the Yellow Brick Road |
|Oz |13049 |Along the Yellow Brick Road |
|Oz |13052 |Along the Yellow Brick Road |
|Oz |13057 |Along the Yellow Brick Road |
|Oz |13058 |Along the Yellow Brick Road |
|Oz |13060 |Along the Yellow Brick Road |
|Oz |13067 |Along the Yellow Brick Road |
|Oz |13068 |Along the Yellow Brick Road |
|Oz |13077 |Along the Yellow Brick Road |
|Oz |13078 |Along the Yellow Brick Road |
|Oz |13089 |Along the Yellow Brick Road |
|Oz |13090 |Along the Yellow Brick Road |

Total results: 16


I originally used Nick Gammon's SMAUG example as a template, but have ended up taking a much different approach in the long run, the biggest difference being the use of a single mud-wide lua state. In reality it's fundamentally much more similar to Lunacy, but with a more thorough implementation.

As mentioned, the first goal was to support lua mprogs. I also had the desire to have 'global' variables persist on a per mob basis between prog calls. To accomplish this, when a mob runs a script, it runs in its own dedicated environment table that will exist as long as the mob does.

Ok, well I'm getting a little long winded here. My real purpose for posting was that I was hoping to share some code, both to help others as well as for feedback. My thought was to create 'QuickMUD with Lua' as an easy way to accommodate both reasons. Is anybody interested in seeing such a thing?
02 May, 2014, Odoth wrote in the 2nd comment:
Votes: 0
I think I will be working on creating some sort of Quickmud + Lua, but for now if interested, you can view the Aarchon lua source here:
http://rooflez.com/luastuff/arclua/
06 Mar, 2016, Odoth wrote in the 3rd comment:
Votes: 1
06 Mar, 2016, Rhien wrote in the 4th comment:
Votes: 0
Very cool. Looking forward to taking a look at this when I get a second. :)
0.0/4