Lua is the scripting language used by Diorama. See http://www.lua.org/

Currently there are three classifications of lua scripts:

  • Front End
  • Client Mods
  • Server Mods

All script files are located in /resources/scripts. All three are started at different points of the application lifetime.

  • The Front End is loaded on application begin (entry point in /menus/main.lua), and unloaded on application end
  • The Client Mods are loaded whenever a session begins (entry point in /session/client_mods.lua), and unloaded on session end
  • The Server Mods are loaded whenever a session begins (entry point in /session/server_mods.lua), and unloaded on session end

The client_mods.lua and server_mods.lua files (only) gain access to dio.mods namespace from which they can call dio.mods.loadMod().

Mods

  • Mods consist of a unique folder name in /resources/scripts/session (referenced in dio.mods.loadMod()) and at least a single main.lua inside it.
  • Each lua mod is loaded inside it's own lua state, meaning inter-mod communication is currently unavailable.
  • The order in which mods are loaded represents the order in which events get passed to each of the mods.
  • the convention for a correct mod is the main.lua returns two objects: modSettings [table] and onLoadSuccessful [function]

modSettings [table]

local modSettings =
{
	id = "SPWN",

	name = "Spawn",
 	description = "Coordinate related shenanigans",
	author = "AmazedStream",
 
	help = 
	{
		[".spawn"] = 	{usage = ".spawn", 		description = "teleports you to the safe spawn"},
		[".tp"] = 		{usage = ".tp x y z", 	description = "teleports you coordinates (x, y, z)"},
		[".coords"] = 	{usage = ".coords ", 	description = "prints your or N players coordinates"},
	},

	permissionsRequired =
	{
		client = true,
		player = true,
	},
}

Twitch | Twitter