Added Some Functions. _lua looks good!
This commit is contained in:
parent
332fce2eb7
commit
a1d4328ec4
2 changed files with 38 additions and 5 deletions
|
|
@ -89,11 +89,33 @@ namespace TShockAPI.LuaSystem
|
||||||
|
|
||||||
public void RegisterLuaFunctions()
|
public void RegisterLuaFunctions()
|
||||||
{
|
{
|
||||||
LuaFunctions LuaFuncs = new LuaFunctions(this);
|
//I just added all the managers for Plugin Development. :)
|
||||||
_lua.RegisterFunction("Print", LuaFuncs, LuaFuncs.GetType().GetMethod("Print"));
|
//Feel free to remove any if you dont feel they are necessay
|
||||||
_lua.RegisterFunction("HookAdd", LuaFuncs, LuaFuncs.GetType().GetMethod("HookAdd"));
|
_lua["Players"] = TShock.Players;
|
||||||
_lua.RegisterFunction("HookRemove", LuaFuncs, LuaFuncs.GetType().GetMethod("HookRemove"));
|
_lua["Bans"] = TShock.Bans;
|
||||||
|
_lua["Warps"] = TShock.Warps;
|
||||||
|
_lua["Regions"] = TShock.Regions;
|
||||||
|
_lua["Backups"] = TShock.Backups;
|
||||||
|
_lua["Groups"] = TShock.Groups;
|
||||||
|
_lua["Users"] = TShock.Users;
|
||||||
|
_lua["Itembans"] = TShock.Users;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LuaFunctions LuaFuncs = new LuaFunctions(this);
|
||||||
|
var LuaFuncMethods = LuaFuncs.GetType().GetMethods();
|
||||||
|
foreach (System.Reflection.MethodInfo method in LuaFuncMethods)
|
||||||
|
{
|
||||||
|
_lua.RegisterFunction(method.Name, LuaFuncs, method);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Utils
|
||||||
|
Utils LuaUtils = new Utils(this);
|
||||||
|
var LuaUtilMethods = LuaUtils.GetType().GetMethods();
|
||||||
|
foreach (System.Reflection.MethodInfo method in LuaUtilMethods)
|
||||||
|
{
|
||||||
|
_lua.RegisterFunction(method.Name, LuaUtils, method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,22 @@ using System.Net.Sockets;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
|
using TShockAPI.LuaSystem;
|
||||||
|
|
||||||
namespace TShockAPI
|
namespace TShockAPI
|
||||||
{
|
{
|
||||||
public class Utils
|
public class Utils
|
||||||
{
|
{
|
||||||
|
LuaLoader Parent; //For Lua Functions that require the LuaLoader
|
||||||
|
public Utils()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Utils(LuaLoader parent)
|
||||||
|
{
|
||||||
|
Parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
public Random Random = new Random();
|
public Random Random = new Random();
|
||||||
//private static List<Group> groups = new List<Group>();
|
//private static List<Group> groups = new List<Group>();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue