variables

Post Reply
vint
Posts: 13
Joined: Sat Jul 03, 2010 9:01 pm

variables

Post by vint »

okay, how to i make and save variables so they will stay on while i quit? i've heard talk of tables, but i don't understand how they work, is there a site that might tell me what to do? and is it possible to make a new variable based on a trigger?

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: variables

Post by tsuujin »

There are a couple of ways to do this, but it's not as simple as it is on other clients. Mudlet uses a raw Lua sandbox for all the coding, which makes for fast and reliable systems but does not allow for variables to carry between sessions.

There are two common ways to accomplish this in Mudlet. The first is to use table.save and table.load, which will load the contents of an entire Lua table to and from a physical file on the disk. You can find information on Lua tables here.

The other way is to use a database to store your variables between sessions. This tends to be a little more complicated, but is my preferred method. The Mudlet Manual has more information on this, and you can also search these forums.

Post Reply