Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
- <External>null</External>
- <External>nil</External>
- <Item class="ModuleScript" referent="RBX519F8599BEF44868B0830BCFC0C06B75">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Celery</string>
- <string name="ScriptGuid">{122C8863-2E51-4687-BB14-053839FE36FC}</string>
- <ProtectedString name="Source"><![CDATA[--[[
- Hi; Rerumu here leaking my own admin.
- Yes I am bored.
- No I do not care.
- Hoping you lovelies enjoy my work. Read along as to learn how some features such as the remote
- api are implemented and how injects can be added.
- --]]
- local next = next;
- local wait = wait;
- local pcall = pcall;
- local script = script;
- local require = require;
- local Code = script('WaitForChild', 'Code')'Clone';
- local Deps = script('WaitForChild', 'Deps')'Clone';
- script'ClearAllChildren'; -- Doesn't matter but GC is a pain.
- setfenv(1, {}); -- Refer to previous comment.
- local Clear;
- local Insert = table.insert;
- local Ran, System = pcall(require, 626335321);
- if (not Ran) or System.Ran then return nil; end;
- local Load = {};
- for _, Name in next, {'System', 'Profile', 'Commands', 'Themes', 'Process'} do
- Insert(Load, Code:WaitForChild(Name));
- end;
- Code = nil;
- Clear = System();
- Clear.Deps = Deps;
- function Clear.WaitFor(Idx)
- local F = Clear[Idx];
- while (not F) do
- F = Clear[Idx];
- wait(1 / 120);
- end;
- return F;
- end;
- System(Load); -- Start up the modules.
- return 70540486; -- Hey; that's me.]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="Folder" referent="RBX619AF376B7264A5FB1BBDEC82852777B">
- <Properties>
- <string name="Name">Code</string>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ModuleScript" referent="RBX4BD6654BC6064C039F936FE1CEE10011">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">System</string>
- <string name="ScriptGuid">{CCAF17DD-FF63-4627-AD78-6780ADEC0DF4}</string>
- <ProtectedString name="Source"><![CDATA[return function() -- Api stuff handled here for the most part.
- local Clear = Clear;
- local System = {};
- local Settings = {
- Prefix = '?';
- Batch = '/';
- Console = 'BackSlash';
- Reserves = {};
- Message = 'No Message';
- };
- local Str = tostring;
- local Abs = math.abs;
- local Insert = table.insert;
- local DStoreK = 'NotGivingYouRealKey';
- local DStore = Clear.DataStoreService('GetDataStore', Clear.HashCrc32(DStoreK), 'Unversed');
- local Remote = Clear.Remote;
- local SettingK = Clear.HashMD5(DStoreK);
- local ChangeE = Clear.Create'BindableEvent'{Name = 'SettingsChanged'};
- -- NOTE: I have literally no need to steal your keys; I guess this is up to you but the script's main commands work without them regardless.
- local Auth = { -- Api keys for Discord, pastebin and whatelse go here.
- Mashape = 'x'; -- Mashape key for external services.
- Pastebin = {
- Dev = 'x'; -- Your developer api key.
- Pass = 'x'; -- Pastebin api does ask for your password.
- };
- Discord = {
- Token = 'x'; -- Your BOT TOKEN. Without "bot " before it.
- Hook = 'x'; -- Your WEBHOOK ID.
- HookT = 'x'; -- Your WEBHOOK TOKEN.
- Channel = 'x'; -- The CHANNEL ID for the channel which you want to use for remote commands.
- };
- };
- local Deps = Clear.Deps;
- local G, Game = pcall(Clear.MarketplaceService.GetProductInfo, Clear.MarketplaceService, game.PlaceId);
- local Variables = {};
- local Objects = {};
- local GuiHash = {};
- local Permission;
- local Discord;
- local Inject;
- System.Logs = {Chat = {}, Command = {}};
- System.Objects = Objects;
- System.SChanged = ChangeE.Event;
- function System.GetVar(What)
- return Variables[What];
- end;
- function System.SetVar(What, To)
- Variables[What] = To;
- end;
- function System.WipeSettings() -- Never really implemented this.
- return DStore('UpdateAsync', SettingK, function() return false; end);
- end;
- function System.GetSettings()
- return System.Copy(Settings);
- end;
- function System.SetSetting(K, V)
- if (typeof(Settings[K]) == typeof(V)) then
- Settings[K] = V;
- end;
- end;
- function System.UpdateSettings()
- local Got = DStore('GetAsync', SettingK);
- local Set = Settings;
- if Got then
- Settings = Clear.RDecode(Got);
- end;
- Settings = Set;
- ChangeE:Fire(System.Copy(Settings));
- return Set;
- end;
- function System.SaveSettings()
- local Enc = Clear.REncode(Settings);
- return DStore('UpdateAsync', SettingK, function(Old)
- return Enc;
- end);
- end;
- function System.FindClass(Object, Name, List)
- for _, Child in next, Object:GetChildren() do
- pcall(function()
- if Child:IsA(Name) then
- Insert(List, Child);
- end;
- if (#Child:GetChildren() ~= 0) then
- System.FindClass(Child, Name, List);
- end;
- end);
- end;
- return List;
- end;
- function System.IsGui(Gui)
- return GuiHash[Str(Gui)];
- end;
- function System.LoadGui(Pl, Gui, Data)
- local Gui = System.Dep('2D', Gui);
- if Gui then
- local New = Gui:Clone();
- local Name = GuiHash[Gui.Name];
- if (not Name) then
- Name = Clear.HashCrc32(Gui.Name);
- GuiHash[Name] = Gui.Name;
- GuiHash[Gui.Name] = Name;
- end;
- New.Name = Name;
- New.Parent = Pl:FindFirstChildOfClass'PlayerGui';
- Remote.Send(Pl, 'Load', New:FindFirstChild'Code', Data);
- return New;
- end;
- end;
- function System.HasGui(Pl, Name)
- local Gui = Pl:FindFirstChildOfClass'PlayerGui';
- local Name = GuiHash[Name];
- if Gui and Name then
- return Gui:FindFirstChild(Name);
- else
- return false;
- end;
- end;
- function System.Recent(Num1, Num2)
- local x1, y1, z1 = Num1:match('(%d-):(%d%d):(%d%d)');
- local x2, y2, z2 = Num2:match('(%d-):(%d%d):(%d%d)');
- local Result;
- if (x1 == x2) and (y1 == y2) then
- Result = (Abs(z1 - z2)) < 36;
- end;
- return Result;
- end;
- function System.Index(...)
- local Objs = {...};
- for K = 1, #Objs do
- Insert(Objects, Objs[K]);
- end;
- return Objs;
- end;
- function System.Dep(S, ...)
- local Data = {...};
- local Last = Deps:FindFirstChild(S) or Deps:WaitForChild(S, math.huge);
- for Idx = 1, #Data do
- if (not Last) then break; end;
- Last = Last:FindFirstChild(Data[Idx]);
- end;
- return Last;
- end;
- function System.Copy(T)
- if (type(T) ~= 'table') then return T; end;
- local Init = {};
- for K, V in next, T do
- if (type(V) == 'table') then
- Init[K] = System.Copy(V);
- else
- Init[K] = V;
- end;
- end;
- return Init;
- end;
- if (not G) then
- warn('Game error get.\n', Game);
- Game = {
- Name = 'Fetch Request Error';
- AssetId = game.PlaceId;
- Creator = {Id = game.CreatorId, Name = 'Unknown'};
- Description = 'There was an error when Celery attempted to fetch game data.';
- };
- end;
- if Clear.HttpConnect() then
- Discord = Clear.HttpRemote('Discord', { -- Connects your Discord api services.
- Auth = Auth.Discord.Token;
- HookId = Auth.Discord.Hook;
- HookToken = Auth.Discord.HookT;
- });
- Inject = {}; -- NOTE: A table full of injects. (Can be locals, folders, models, whatever.)
- if Inject[1] then
- local Cased = {};
- for _, Inj in next, Inject do
- Cased[Inj.Name:lower()] = Inj;
- end;
- Inject = Cased;
- end;
- -- elseif (Game.Creator.Id ~= 70540486) then -- Old stuff for preventing non-HTTP usage.
- -- local Kick = Clear.Kick;
- -- local Wait = wait;
- --
- -- repeat Kick('all', 'Fatal error~! =o^o='); Wait(1 / 120) until false;
- end;
- System.Cross = Clear.Create'BindableEvent'{Name = 'CeleryCross'}; -- Cross-server-script.
- System.DStoreK = DStoreK;
- System.DStore = DStore;
- System.Injects = Inject;
- System.Discord = Discord;
- System.Auth = Auth;
- System.Game = Game;
- System.ServerKey = Clear.GetRandom(64);
- Clear.Deps = nil;
- Clear.System = System;
- Clear.Thread(System.UpdateSettings);
- pcall(game.BindToClose, game, System.SaveSettings);
- pcall(DStore.OnUpdate, DStore, SettingK, function(New)
- Clear.Thread(function()
- Settings = Clear.RDecode(New);
- ChangeE:Fire(System.Copy(Settings));
- end);
- end);
- warn'Celery Open Source System loaded.';
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX121F9824BAC84C949E26457FCFB37D80">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Profile</string>
- <string name="ScriptGuid">{2F57C009-CE2A-4E8C-9C9E-B710AF278347}</string>
- <ProtectedString name="Source"><![CDATA[script = nil;
- return function()
- local Clear = Clear; -- Profiling system.
- local System = Clear.WaitFor'System';
- local Profiles = {};
- local DStoreK = System.DStoreK;
- local DStore = System.DStore;
- local Tonu = tonumber;
- local Shift = Clear.Shift;
- local typeof = typeof;
- local GetAsync = DStore.GetAsync;
- local SetAsync = DStore.SetAsync;
- local Highperms = {Registered = 1, User = 2, Scripter = 3, Enforcer = 4, Trusted = 7, Discord = 10, Unversed = 11};
- local Cache = {};
- local Discord = {};
- local DiscIds = { -- Format: personName:discordId:userId
- 'You:1234:4567',
- 'YourFriend:4321:9876', -- Allows for use of remote stuff.
- };
- local Bans = {
- {98663073, 'Oof.'}; -- TycoonKing1981
- };
- local Defaults = {
- {
- Clearance = {'Unversed', 'Trusted', 'Enforcer', 'User'};
- UserId = 48013251;
- Alias = 'Reru\'s';
- };
- {
- Clearance = {'Unversed', 'Enforcer', 'User'};
- UserId = 74283277;
- };
- {
- Clearance = {'Unversed', 'Enforcer'};
- UserId = 32873573;
- };
- {
- Clearance = {'Unversed', 'Enforcer'};
- UserId = 10517389;
- };
- {
- Clearance = {'Scripter', 'Enforcer'};
- UserId = 13282741;
- };
- {
- Clearance = 'Unrestricted';
- UserId = 27744504;
- };
- {
- Clearance = 'Unrestricted';
- UserId = 79048679;
- };
- {
- Clearance = 'Unrestricted';
- UserId = 70540486;
- Alias = 'Reruuu';
- Image = '707741687';
- };
- };
- for Idx = 1, #Bans do
- local Ban = Bans[Idx];
- Defaults[#Defaults + 1] = {
- Registered = true;
- Banned = Ban[2];
- UserId = Ban[1];
- };
- end;
- for Idx = 1, #DiscIds do
- local Id, UserId = DiscIds[Idx]:match'%w+:(%d+):(%d+)';
- Discord[Id] = Tonu(UserId);
- end;
- DiscIds = nil;
- System.DStoreK, System.DStore = nil, nil;
- -- local function Shift(A, B) return (A * 2) % (2 ^ B) end;
- local Names = {
- {'This', 'Is', 'Very'};
- {'Old', 'And', 'Should'};
- {'Not', 'Be', 'Used'};
- };
- local function RandomizeName(UserId)
- local Name = '';
- local Prev = UserId % 256;
- local Fin = 0;
- for Idz = 1, 3 do
- local Section = Names[Idz];
- local Sect = #Section;
- for Idx = 1, Shift(UserId, Sect + (Idz * 2)) do
- Fin = Shift((Sect ^ 3) * Prev + ((Sect * Idx) + Idx * (Prev + Idz)) % ((128 - Sect) + Prev), (((Prev + Idx * Sect) % 256) + (Sect + Idz ^ 2)) % 32);
- end;
- Name = Name .. Section[(Fin % Sect) + 1];
- Prev = Fin % 256;
- Fin = 0;
- end;
- return Name;
- end;
- function Profiles.Update(PlayerList)
- local Listed = {};
- local Remove = {};
- for Idx = 1, #PlayerList do
- local Player = PlayerList[Idx];
- local Prof = Profiles.Get(Player);
- if Prof.Registered then
- local Obj = {
- Alias = Prof.Alias;
- Bio = Prof.Bio;
- Banned = Prof.Banned;
- Name = Player.Name;
- UserId = Player.UserId;
- Image = Prof.Image;
- Color = Prof.Color;
- };
- Listed[#Listed + 1] = Obj;
- end;
- Remove[#Remove + 1] = Prof.UserId;
- end;
- DStore('UpdateAsync', Clear.HashSha1'SomeDataStoreKey', function(Last)
- local Last = Clear.JDecode(Last or '[]');
- local New = {};
- for Idx = 1, #Remove do
- local Id = Remove[Idx];
- for Idz, Val in next, Last do
- if (Val.UserId == Id) then
- Last[Idz] = nil;
- break;
- end;
- end;
- end;
- for Idx = 1, #Listed do
- Last[#Last + 1] = Listed[Idx];
- end;
- for _, Val in next, Last do
- New[#New + 1] = Val;
- end;
- System.Database = New;
- return Clear.JEncode(New);
- end);
- end;
- function Profiles.Picture(Prof)
- local Cache = Prof.Cache;
- local Image = Cache.Image;
- if (not Image) then
- local R, Fetch = pcall(Clear.DoGet, 'http://rprxy.xyz/headshot-thumbnail/json?userId=' .. Prof.UserId .. '&width=180&height=180');
- if R then
- Image = Clear.JDecode(Fetch).Url;
- else
- warn('Fetch Error;', Fetch);
- Image = 'https://cdn.discordapp.com/attachments/283069308613951488/310858222061748234/page-not-found-300x270.png';
- end;
- Cache.Image = Image;
- end;
- return Image;
- end;
- function Profiles.PermLevel(Pl)
- local Data = Profiles.Get(Pl);
- local Po = 0;
- if (Data.Clearance == 'Unrestricted') then
- return 9e9;
- else
- local Ca = Data.Cache;
- for Idx, Val in next, Highperms do
- if Ca[Idx] then
- Po = Po + Val;
- end;
- end;
- return Po;
- end;
- end;
- function Profiles.IsHigher(A, B)
- return Profiles.PermLevel(A) > Profiles.PermLevel(B);
- end;
- function Profiles.Permission(Who, List)
- local Data = Profiles.Get(Who);
- local Cach = Data.Cache;
- local Got;
- if (Data.Clearance == 'Unrestricted') or (List == 'Unindexed') or (#List == 0) then
- return true;
- elseif (type(List) == 'string') then
- return Cach[List];
- end;
- for K = 1, #List do
- Got = Cach[List[K]];
- if Got then break; end;
- end;
- return Got;
- end;
- function Profiles.FromId(EnteredId, Passed)
- local Id = Tonu(EnteredId);
- local Conc = Clear.HashMD5(DStoreK .. Id);
- local Prof = GetAsync(DStore, Conc);
- local Init;
- for Idx = 1, #Defaults do
- local Dt = Defaults[Idx];
- if (Dt.UserId == Id) then
- Init = Dt;
- break;
- end;
- end;
- local Loaded;
- if (type(Prof) == 'string') then
- Loaded = Clear.RDecode(Prof);
- else
- Loaded = {};
- end;
- local Default = {
- Clearance = {};
- StoreK = Conc;
- UserId = Id;
- Color = BrickColor.Random().Number;
- Bio = 'No bio.';
- Theme = 'Revolve';
- Image = 330916575; -- Unversed Logo.
- Registered = false;
- Banned = false;
- };
- for Idx, Val in next, Default do
- if (Loaded[Idx] == nil) then
- Loaded[Idx] = Val;
- end;
- end;
- if Init then
- for Idx, Val in next, System.Copy(Init) do
- Loaded[Idx] = Val;
- end;
- end;
- if (not Loaded.Alias) then
- Loaded.Alias = RandomizeName(Id);
- end;
- local Clearance = Loaded.Clearance;
- local Cache = {};
- Loaded.Cache = Cache;
- Loaded.Registered = (#Clearance ~= 0);
- if (type(Clearance) == 'table') then
- for Idx = 1, #Clearance do
- Cache[Clearance[Idx]] = true;
- end;
- Cache.Registered = Loaded.Registered;
- end;
- if Passed then
- Passed:Fire(Loaded);
- end;
- return Loaded;
- end;
- function Profiles.Save(Id, Data)
- local Conc = Data.StoreK or Clear.HashMD5(DStoreK .. Id);
- local Save = System.Copy(Data);
- Save.Cache = nil;
- SetAsync(DStore, Conc, Clear.REncode(Save));
- end;
- function Profiles.Get(Who)
- local UID;
- if Discord[Who] then
- return Profiles.Get(Discord[Who]);
- elseif (typeof(Who) == 'Instance') and Who:IsA'Player' then
- UID = Who.UserId;
- elseif (type(Who) == 'number') and ((Who % 1) == 0) then
- UID = Who;
- end;
- if UID then
- local Prof = Cache[UID];
- if (not Prof) then
- local Data = Instance.new'BindableEvent';
- Cache[UID] = Data;
- Prof = Profiles.FromId(UID, Data);
- elseif (typeof(Prof) == 'Instance') then
- return Prof.Event:wait();
- end;
- Cache[UID] = Prof;
- return Prof;
- else
- return;
- end;
- end;
- function Profiles.Cached(Id)
- return Cache[Id];
- end;
- function Profiles.UnCache(Id)
- local Prof = Cache[Id];
- if Prof and Prof.Cache then
- for _, Data in next, Prof.Cache do
- if (typeof(Data) == 'RBXScriptSignal') then
- Data:Disconnect();
- end;
- end;
- end;
- Cache[Id] = nil;
- end;
- function Profiles.Delete(Id)
- Profiles.UnCache(Id);
- SetAsync(DStore, Clear.HashMD5(DStoreK .. Id), false);
- end;
- Clear.Profiles = Profiles;
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBXCC9EE6E296164034BC80DFB0C5165521">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Process</string>
- <string name="ScriptGuid">{12F95956-C23C-41A0-A264-6D85CAA9CD56}</string>
- <ProtectedString name="Source"><![CDATA[return function() -- NOTE: This contains *some* of the Api.
- local Clear = Clear;
- local System = Clear.WaitFor'System';
- local Profiles = Clear.WaitFor'Profiles';
- local Commands = Clear.WaitFor'Commands';
- local Themes = Clear.WaitFor'Themes';
- local Billboard = Clear.Create'BillboardGui';
- local GetRandom = Clear.GetRandom;
- local Discord = System.Discord;
- local Players = Clear.Players;
- local Remote = Clear.Remote;
- local Thread = Clear.Thread;
- local Cross = System.Cross;
- local Label = Clear.Create'TextLabel';
- local Image = Clear.Create'ImageLabel';
- local Beat = Clear.RunService.Heartbeat;
- local UDim2 = UDim2.new;
- local Color3 = Color3.new;
- local Vector2 = Vector2.new;
- local BrickRand = BrickColor.Random;
- local BrickColor = BrickColor.new;
- local Notify = Commands.Notify;
- local Insert = table.insert;
- local Remove = table.remove;
- local Gsub = string.gsub;
- local Sub = string.sub;
- local Str = tostring;
- local CData = setmetatable({}, {__mode = 'k', __metatable = 'Crystals'});
- local Crystals = {System.Dep('3D', 'LowPoly'); System.Dep('3D', 'MidPoly'); System.Dep('3D', 'HighPoly')};
- local ChatLogs = System.Logs.Chat;
- local Discord = System.Discord;
- local WebhookE;
- local Settings;
- local function CustomEnv(Player)
- return {
- Player = Player;
- Limbo = function()
- return Clear.RealEnv;
- end;
- Save = function(Ins, Name)
- if (typeof(Ins) == 'Instance') then
- Ins.Archivable = true;
- local K = Ins:Clone();
- K.Name = (Name and tostring(Name)) or Ins.Name;
- pcall(function() K.Parent = Clear.ServerStorage:FindFirstChild'Cl_Saved' or Clear.Create'Folder'{Parent = Clear.ServerStorage, Name = 'Cl_Saved'}; end);
- return K;
- else
- error('Instance expected.', 0);
- end;
- end;
- SavePlace = function()
- return Clear.AssetService:SavePlaceAsync();
- end;
- CreatePlace = function(Name, Id, Desc)
- return Clear.AssetService:CreatePlaceInPlayerInventoryAsync(Player, Name, Id, Desc);
- end;
- SaveInstance = function(What, Where)
- if Player.DataReady then
- return Player:SaveInstance(Where or 'CaseOneInstance', What);
- else
- return Commands.Run(Player, 'ColorNotify', {nil, 1004, 'Error while saving instance, try again.'});
- end;
- end;
- LoadInstance = function(Where)
- if Player.DataReady then
- return Player:LoadInstance(Where or 'CaseOneInstance');
- else
- return Commands.Run(Player, 'ColorNotify', {nil, 1004, 'Error while loading instance, try again.'});
- end;
- end;
- Export = function(...)
- local Args = {...};
- local Out = {};
- for _, K in next, Args do
- Insert(Out, Str(K));
- end;
- Out = Sub(Clear.Trim(table.concat(Out, '\n')), 1, 2000);
- Discord.HookMessage{
- username = 'LuaExport';
- content = Out;
- };
- return Out;
- end;
- print = function(...)
- local Args = {...};
- local White = BrickColor(1);
- pcall(function()
- for _, Arg in next, Args do
- Notify(Player, tostring(Arg), White, 'SciFi');
- end;
- end);
- return print(...);
- end;
- warn = function(...)
- local Args = {...};
- local Yellow = BrickColor(24);
- pcall(function()
- for _, Arg in pairs(Args) do
- Notify(Player, tostring(Arg), Yellow, 'SciFi');
- end;
- end);
- return warn(...);
- end;
- setfenv = function(A, B)
- if (type(A) == 'function') then
- return setfenv(A, B);
- end;
- end;
- getfenv = function(Env)
- if (type(Env) == 'function') then
- return getfenv(Env);
- end
- end;
- Get = function(Class, Where)
- return System.FindClass(Where or game, Class, {});
- end;
- Event = Clear.Memoize(function(Name)
- local Ev;
- for _, Service in next, game:GetChildren() do
- pcall(function()
- if (typeof(Service[Name]) == 'RBXScriptSignal') then
- Ev = Service[Name];
- end;
- end);
- if Ev then
- break;
- end;
- end;
- return Ev;
- end);
- Method = Clear.Memoize(function(Want)
- local Env = Clear.RealEnv;
- if Env then
- for Idx, Val in next, Env do
- if (type(Idx) == 'userdata') then
- local R, E = pcall(Val);
- if E then
- local Name = E:match'member function (%a+)';
- if (Name == Want) or (Val == Want) then
- return Idx;
- end;
- end;
- end;
- end;
- else
- error('Limbo must be first enabled.', 2); -- NOTE: It won't ever be.
- end;
- end);
- Error = function(Conn)
- return Clear.Pconnect(Clear.ScriptContext.Error, function(_, _, S)
- Conn(S);
- end);
- end;
- };
- end;
- Clear.Environments = Clear.Memoize(function(Pl)
- local New, E = Clear.CreateEnv(CustomEnv(Pl));
- if (Profiles.Get(Pl).Clearance ~= 'Unrestricted') then
- E.Clear = nil;
- end;
- return New;
- end, false);
- function Clear.SetDiscordActive(Bool)
- WebhookE = Bool;
- end;
- Clear.Pconnect(System.SChanged, function(Set)
- Settings = Set;
- end);
- Settings = System.GetSettings();
- local Load = function(Pl)
- Profiles.UnCache(Pl.UserId);
- local Data = Profiles.Get(Pl);
- local Ban = Data.Banned;
- if Ban then
- local Reason = (type(Ban) == 'string') and Ban;
- Clear.Kick(Pl, Reason or 'You are banned.');
- else
- local Theme = Data.Theme or '';
- Thread(Themes[Theme] or Themes.Revolve, Pl);
- end;
- end;
- local Dismiss = function(What)
- if What:FindFirstChild'Dismiss' then return; else local K = Instance.new'BoolValue'; K.Name = 'Dismiss'; K.Parent = What; end;
- local Siz = What.Size;
- local Pos;
- for Idx = 0, 30 do
- Pos = What.CFrame;
- What.Transparency = Idx / 30;
- What.Size = Siz / ((Idx / 4) + 1);
- What.CFrame = Pos;
- Beat:wait();
- end;
- What:Destroy();
- end;
- Clear.Dismiss = Dismiss;
- function Clear.Assign(Pl, Cr, Assigned)
- CData[Cr] = Assigned or 'Dismiss';
- return Cross:Fire('IndexObject', Pl, Cr);
- end;
- function Clear.Interpret(Crystal, Data)
- local Kr = Data or (Crystal and CData[Crystal]);
- if Kr then
- CData[Crystal] = nil;
- if (Kr == 'Dismiss') then
- Thread(Dismiss, Crystal);
- elseif (Kr[1] == 'Command') then
- Thread(Dismiss, Crystal);
- Commands.Run(Kr[2], Kr[3], Kr[4]);
- end;
- end;
- return Kr;
- end;
- function Clear.Crystal(Type, Color, ...)
- local Data = {...};
- local Crys = Crystals[Type]:Clone();
- local BData = {
- Name = GetRandom();
- Parent = Crys;
- SizeOffset = Vector2(0, 1);
- Size = UDim2(8, 0, 4, 0);
- };
- Crys.Name = GetRandom();
- Crys.BrickColor = (Color and BrickColor(Color)) or BrickRand();
- for Idx = 1, #Data do
- Insert(BData, Data[Idx]);
- end;
- local Bill = Billboard(BData);
- return Crys;
- end;
- function Clear.Image(ImageId)
- return Image{
- Name = 'Image' .. ImageId;
- BackgroundTransparency = 1;
- Size = UDim2(0.25, 0, 0.5, 0);
- Position = UDim2(0.375, 0, 0.5, 0);
- Image = 'rbxassetid://' .. ImageId;
- };
- end;
- function Clear.Text(T, C, F)
- local T = Str(T or '');
- local C = C or BrickRand().Color;
- local F = F or 'Arial';
- return Label{
- Name = F .. T;
- BackgroundTransparency = 1;
- TextStrokeTransparency = 0.3;
- Text = T;
- TextColor3 = C;
- TextStrokeColor3 = Color3(C.r * 0.6, C.g * 0.6, C.b * 0.6);
- Font = F;
- FontSize = 'Size18';
- TextScaled = #T > 60;
- TextWrapped = true;
- TextYAlignment = 'Bottom';
- Size = UDim2(1, 0, 1, 0);
- };
- end;
- Clear.Pconnect(Players.PlayerAdded, Load);
- Clear.Pconnect(Players.PlayerRemoving, function(Pl)
- local Data = Profiles.Get(Pl);
- if Data.Registered or Data.Banned then
- Profiles.Save(Pl, Data);
- end;
- Profiles.UnCache(Pl.UserId);
- end);
- for _, User in next, Players:GetPlayers() do
- Thread(Load, User);
- end;
- if Discord then
- local Game = System.Game;
- local Desc = Gsub(Game.Description, '\n', ' ');
- if (#Desc > 180) then
- Desc = Sub(Desc, 1, 177) .. '...';
- end;
- local Embeds = {
- {
- title = Game.Name, url = 'https://www.roblox.com/games/' .. Game.AssetId .. '/Game' .. Clear.UrlEncode(Gsub(tostring(Game.Name), '%W', ''));
- footer = {text = Desc};
- };
- };
- Thread(function()
- local Players = Clear.Players;
- while (#Players:GetPlayers() == 0) do wait(1 / 120); end;
- for _, Player in next, Clear.GrabPlayer() do
- local Prof = Profiles.Get(Player)
- local Cle = System.Copy(Prof.Clearance);
- if (type(Cle) == 'table') then
- if Prof.Registered then
- Insert(Cle, 'Registered');
- else
- Insert(Cle, 'Unregistered');
- end;
- Cle = table.concat(Cle, '; ') .. '.';
- else
- Cle = Cle .. '.';
- end;
- Insert(Embeds, {
- title = Player.Name .. ' (' .. Prof.Alias .. ')';
- color = (math.random(1, 256) ^ 3) - 1;
- url = 'https://www.roblox.com/users/' .. Player.UserId .. '/profile';
- description = Prof.Bio;
- footer = {text = Cle, icon_url = Profiles.Picture(Prof)};
- });
- end;
- local Sent, Err = pcall(Discord.HookMessage, {
- username = 'Notification';
- content = 'Server Startup; ' .. Clear.FromUnix(os.time()) .. '.';
- embeds = Embeds;
- });
- if (not Sent) then
- warn('Startup Error', Err);
- else
- local Map = Instance.new'Folder';
- for _, Child in next, workspace:GetChildren() do
- if (Child.ClassName ~= 'Terrain') and (Child:IsA'BasePart' or (Child.ClassName == 'Model')) then
- local Cloned = Child:Clone();
- if Cloned then
- Cloned.Parent = Map;
- end;
- end;
- end;
- System.SetVar('BackupMap', Map);
- end;
- end);
- Thread(function()
- local isWorking, e;
- local Cache = {};
- local Auth = System.Auth.Discord.Channel;
- local Wait = false;
- local Runt = 0;
- Clear.RunService.Stepped:Connect(function(Del)
- if Wait then return; end;
- Wait = true;
- if (Runt % 10) == 0 then
- Profiles.Update(Clear.Players:GetPlayers());
- end;
- isWorking, e = pcall(function()
- local Messages = Discord.GetMessages(Auth);
- for _, Msg in Clear.RIpairs(Messages) do
- local Auth = Profiles.Get(Msg.author.id);
- if Auth and (not Cache[Msg.id]) then
- Cache[Msg.id] = true;
- local Content = tostring(Msg.content);
- local Pl, St = Content:match'^!(%S+)%s+(%S+)';
- if Pl and St then
- local Lo, Ls = Pl:lower(), St:lower();
- if (Lo == 'all') or (Game.Name:lower():sub(1, #Lo) == Lo) then
- if (Ls == 'true') then
- WebhookE = true;
- elseif (Ls == 'false') then
- WebhookE = false;
- end;
- end;
- end;
- if WebhookE and System.Recent(Msg.timestamp, Clear.FromUnix(os.time())) then
- local Start, Content = Content:match'(.)(.+)';
- if (Start == '>') then
- Commands.Chatted(Msg.author.id, Settings.Prefix .. Content);
- elseif (Start == '~') then
- Commands.Run(Msg.author.id, 'Message', {Content});
- end;
- end;
- end;
- end;
- end);
- if (not isWorking) then
- warn('Remote Error', e);
- wait(60);
- else
- wait(math.clamp(17 - Players.NumPlayers, 8, 16));
- end;
- Runt = Runt + 1;
- Wait = false;
- end);
- end);
- end;
- function Remote.OnInvoke(Pl, Req)
- if (Req == 'Hash') then
- return Clear.PlayerHash[Pl.UserId];
- end;
- end;
- Clear.Pconnect(Remote.OnEvent, function(Pl, Why, ...)
- local Args = {...};
- local Arg1 = Args[1];
- if (Why == 'CChat') then
- Insert(ChatLogs, {Time = os.time(), Name = Pl.Name, Log = Arg1});
- Remove(ChatLogs, 200);
- elseif (Why == 'Execute') then
- local Msg = Clear.Trim(Arg1);
- if Args[2] then
- Msg = Settings.Prefix .. Msg;
- end;
- if Msg then
- Thread(Commands.Chatted, Pl, Msg);
- end;
- elseif WebhookE and (Why == 'CLog') then
- local Msg = Clear.Trim(tostring(Arg1));
- local Prof = Profiles.Get(Pl);
- local Image = Profiles.Picture(Prof);
- if (#Msg == 0) then return; end;
- Discord.HookMessage{
- username = Pl.Name;
- content = Sub(Gsub(Msg, '@(%S)', '%1'), 1, 2000);
- avatar_url = Image;
- };
- elseif (Why == 'PUpdate') then
- local Prof = Profiles.Get(Pl);
- local Data = Clear.JDecode(Arg1);
- Prof.Alias = Sub(Data.Alias, 1, 16);
- Prof.Bio = Sub(Data.Bio, 1, 200);
- Prof.Color = tonumber(Data.Color);
- Prof.Image = tonumber(Data.Image);
- elseif (Why == 'RemoveGui') and System.IsGui(Arg1) and Arg1:IsA'ScreenGui' then
- Arg1:Destroy();
- elseif (Why == 'Notepad') then
- Pl:SaveString(Clear.HashMD5('NoteStuff' .. Pl.UserId), Str(Arg1));
- elseif (Why == 'Refresh') then
- Commands.Run(Pl, 'RefreshUi', nil);
- elseif (Why == 'CCrystal') and Arg1 then
- Clear.Interpret(Arg1);
- end;
- end);
- Clear.ClientAttach(System.Dep'CeleryClient');
- Clear.RemoteInit();
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX4EEB3981FA474BEB944C457F85A91CB0">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Commands</string>
- <string name="ScriptGuid">{A8E19CBA-7C4B-4003-8C93-A389585B8FF0}</string>
- <ProtectedString name="Source"><![CDATA[return function()
- local Clear = Clear;
- local Profiles = Clear.WaitFor'Profiles';
- local Themes = Clear.WaitFor'Themes';
- local System = Clear.WaitFor'System';
- local Remote = Clear.Remote;
- local PermList = Clear.Memoize(function() return {}; end, false);
- local Commands = {};
- local List = {};
- local Settings;
- local Str = tostring;
- local Sub = string.sub;
- local Trim = Clear.Trim;
- local Lower = string.lower;
- local Match = string.match;
- local Cross = System.Cross;
- local Gmatch = string.gmatch;
- local Insert = table.insert;
- local Remove = table.remove;
- local CmdLogs = System.Logs.Command;
- local SafeChar = Clear.SafeChar;
- local BrickRand = BrickColor.Random;
- local Permission = Profiles.Permission;
- local BrickColor = BrickColor.new;
- Clear.Pconnect(System.SChanged, function(Set)
- Settings = Set;
- end);
- Settings = System.GetSettings();
- local function GetPlayers(plr, names, donterror)
- local players = {};
- local isServer = type(plr) ~= 'userdata';
- local parent = Clear.NetworkServer or Clear.Players;
- local function getplr(p)
- if not p then
- return p
- elseif p:IsA("Player") then
- return p
- elseif p:IsA('NetworkReplicator') then
- local p = p:GetPlayer();
- if p ~= nil and p:IsA('Player') then
- return p
- end
- end
- end
- if (plr == nil) and (not isServer) then
- for i,v in next, parent:GetChildren() do
- local p = getplr(v)
- Insert(players,p)
- end
- elseif plr and not names then
- return {plr}
- elseif names then
- for s in names:gmatch('[^,]+') do
- local plrs = 0
- local function plus()
- plrs = plrs+1
- end
- local function randomPlayer()
- if #players>=#parent:GetChildren() then return end
- local rand = parent:GetChildren()[math.random(#parent:GetChildren())]
- local p=getplr(rand)
- for i,v in next, players do
- if(v==p.Name)then
- randomPlayer()
- return;
- end
- end
- Insert(players,p)
- plus();
- end
- if Lower(s)=='me' and plr then
- Insert(players,plr)
- plus()
- elseif Lower(s)=='all' or Lower(s)=="@everyone" then
- local everyone = true
- if everyone then
- for i,v in next, parent:GetChildren() do
- local p = getplr(v)
- Insert(players,p)
- plus()
- end
- end
- elseif Lower(s)=='others' then
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if p~=plr then
- Insert(players,p)
- plus()
- end
- end
- elseif Lower(s)=='random' then
- randomPlayer();
- plus()
- elseif Lower(s)=='admins' then
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if Profiles.Get(p).Registered then
- Insert(players,p)
- plus()
- end
- end
- elseif Lower(s)=='nonadmins' then
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if not Profiles.Get(p).Registered then
- Insert(players,p)
- plus()
- end
- end
- elseif Lower(s)=='friends' then
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if p:IsFriendsWith(plr.userId) then
- Insert(players,p)
- plus()
- end
- end
- elseif Lower(s)=='besties' then
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if p:IsBestFriendsWith(plr.userId) then
- Insert(players,p)
- plus()
- end
- end
- elseif Lower(s):sub(1,1)=='%' then
- for i,v in next, Clear.Teams:GetChildren() do
- if v.Name:lower():sub(1,#s:sub(2))==Lower(s):sub(2) then
- for k,m in next, parent:GetChildren() do
- local p=getplr(m)
- if p.TeamColor==v.TeamColor then
- Insert(players,p)
- plus()
- end
- end
- end
- end
- elseif Lower(s):sub(1,1)=='$' then
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if tonumber(Lower(s):sub(2)) then
- if p:IsInGroup(tonumber(Lower(s):sub(2))) then
- Insert(players,p)
- plus()
- end
- end
- end
- elseif Lower(s):sub(1,3)=='id-' then
- for i,v in next, parent:GetChildren() do
- local p = getplr(v)
- if tonumber(Lower(s):sub(4)) then
- if p and p.userId==tonumber(Lower(s):sub(4)) then
- Insert(players,p)
- plus()
- end
- end
- end
- elseif Lower(s):sub(1,5)=='team-' then
- for i,v in next, Clear.Teams:GetChildren() do
- if v.Name:lower():sub(1,#s:sub(6))==Lower(s):sub(6) then
- for k,m in next, parent:GetChildren() do
- local p=getplr(m)
- if p.TeamColor==v.TeamColor then
- Insert(players,p)
- plus()
- end
- end
- end
- end
- elseif Lower(s):sub(1,6)=='group-' then
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if tonumber(Lower(s):sub(7)) then
- if p:IsInGroup(tonumber(Lower(s):sub(7))) then
- Insert(players,p)
- plus()
- end
- end
- end
- elseif Lower(s):sub(1,1)=='-' then
- local removes = GetPlayers(plr,Lower(s):sub(2),true)
- for i,v in next, players do
- for k,p in next, removes do
- if v.Name==p.Name then
- Remove(players,i)
- plus()
- end
- end
- end
- elseif Lower(s):sub(1,1)=='#' then
- local num = tonumber(Lower(s):sub(2))
- if(num==nil)then
- error("Invalid number!")
- end
- for i=0,num do
- randomPlayer();
- end
- elseif Lower(s):sub(1,7)=="radius-" then
- local num = tonumber(Lower(s):sub(8))
- if(num==nil)then
- error("Invalid number!")
- end
- for i,v in next, parent:GetChildren() do
- local p=getplr(v)
- if p~=plr and plr:DistanceFromCharacter(p.Character.Head.Position)<=num then
- Insert(players,p)
- plus()
- end
- end
- else
- for i,v in next, parent:GetChildren() do
- local p = getplr(v)
- if p and p.Name:lower():sub(1,#s)==Lower(s) then
- Insert(players,p)
- plus()
- end
- end
- end
- if plrs==0 and not donterror then error('No players matching '..s..' were found!') end
- end
- end
- return players
- end
- local function FromName(N)
- return List[Str(Lower(N))];
- end;
- local function Split(Args, K)
- local List = {};
- local K = K or 1;
- for Whi, Arg in Gmatch(Args, '(%s*)(%S+)') do
- if (#List < K) then
- Insert(List, Arg);
- else
- List[#List] = List[#List] .. Whi .. Arg;
- end;
- end;
- return List;
- end;
- local function Run(Pl, Name, Args, Log)
- local Command = FromName(Name);
- local Args = Args or {};
- if Command then
- if Permission(Pl, Command.Perms) then
- local Ex, Err = Clear.Acall(Command.Function, Pl, Args);
- if (not Log) then
- Insert(CmdLogs, {Time = os.time(), Name = Pl.Name or 'Discord', Log = Str(Args.Message)});
- Remove(CmdLogs, 200);
- end;
- if (not Ex) then
- Clear.Assign(Pl, Clear.Crystal(
- 2,
- 1004,
- Clear.Text(Err, Color3.new(1, 0, 0), 'SciFi')
- ));
- end;
- return true;
- else
- return false, 'You are not allowed to run "' .. Str(Args.Message) .. '"';
- end;
- end;
- end;
- local function Chatted(Pl, Message)
- if (Sub(Trim(Message), 1, 1) ~= Settings.Prefix) then return; end;
- for Str in Gmatch(Message, '[^' .. SafeChar(Settings.Batch) .. ']+') do
- local Pr, Cmd, Args = Match(Trim(Str), '^(' .. SafeChar(Settings.Prefix) .. ')(%w+)%s*(.*)');
- if Pr then
- local Command = FromName(Cmd);
- if Command then
- local ArgList = Split(Args, #Command.Args);
- ArgList.Message = Str;
- local Ex, Err = Run(Pl, Cmd, ArgList, true);
- if (type(Pl) == 'userdata') and (not Ex) then
- Clear.Assign(Pl, Clear.Crystal(
- 2,
- 1004,
- Clear.Text(Err, Color3.new(1, 0, 0), 'SciFi')
- ));
- end;
- else
- break;
- end;
- else
- break;
- end;
- end;
- end;
- local function New(K)
- local Names = K.Names;
- if (not Names) then return; end;
- local Perms = K.Perms;
- local Pnum = #Perms;
- Commands[Names[1]] = K;
- if (Pnum == 0) then
- Insert(PermList.Unindexed, K);
- else
- for Idx = 1, Pnum do
- Insert(PermList[Perms[Idx]], K);
- end;
- end;
- for Idx = 1, #Names do
- List[Lower(Names[Idx])] = K;
- end;
- end;
- -- Api-specific functions.
- local function Notify(Pl, Text, Col, Font, Instr, Typ)
- local C = Col or BrickRand();
- return Clear.Assign(Pl, Clear.Crystal(
- Typ or 2,
- C.Number,
- Clear.Text(Text, C.Color, Font)
- ), Instr);
- end;
- local function INotify(Pl, Image, Col, Instr, Typ)
- local C = Col or BrickRand();
- return Clear.Assign(Pl, Clear.Crystal(
- Typ or 2,
- C.Number,
- Clear.Image(Image)
- ), Instr);
- end;
- New{
- Names = {'EditProfile', 'MyData'};
- Perms = {'Registered'};
- Args = {};
- Function = function(Pl, Args)
- if System.HasGui(Pl, 'Profile') then error'You are already editing your profile.'; end;
- local Data = {};
- local Prof = Profiles.Get(Pl);
- Data.Bio = Prof.Bio;
- Data.Alias = Prof.Alias;
- Data.Color = Prof.Color;
- Data.Image = Prof.Image;
- System.LoadGui(Pl, 'Profile', Data);
- end;
- };
- New{
- Names = {'Profile', 'Me'};
- Perms = {};
- Args = {};
- Function = function(Pl, Args)
- local Profile = Profiles.Get(Pl);
- local Color = BrickColor(Profile.Color);
- if Profile then
- local CData = {};
- Run(Pl, 'Dismiss');
- INotify(Pl, Profile.Image, Color);
- Notify(Pl, 'Alias[] ' .. Profile.Alias, Color, 'SciFi');
- Notify(Pl, 'Bio[] ' .. Profile.Bio, Color, 'SciFi');
- Notify(Pl, 'Color[] ' .. tostring(Color), Color, 'SciFi');
- if (Profile.Clearance == 'Unrestricted') then
- Notify(Pl, 'Unrestricted Clearance', BrickColor'Lavender', 'Fantasy', nil, 3);
- elseif Profile.Registered then
- local Cle = System.Copy(Profile.Clearance);
- Insert(Cle, 'Registered');
- local Perms = table.concat(Cle, '; ');
- Notify(Pl, Perms, BrickColor'Pastel blue', 'Fantasy', nil, 3);
- else
- Notify(Pl, 'No Profile', BrickColor'Crimson', 'SciFi');
- end;
- end;
- end;
- };
- New{
- Names = {'ViewProfile'};
- Perms = {'Registered'};
- Args = {'User', 'LastFilter', 'LastPage'};
- Hidden = true;
- Function = function(Pl, Args)
- local Profile = Args[1];
- Clear.Assert(type(Profile) == 'table', 'This is not a standalone function.');
- local Color = BrickColor(Profile.Color);
- local CData = {};
- Run(Pl, 'Dismiss');
- INotify(Pl, Profile.Image, Color);
- Notify(Pl, 'Alias[] ' .. Profile.Alias, Color, 'SciFi');
- Notify(Pl, 'Bio[] ' .. Profile.Bio, Color, 'SciFi');
- Notify(Pl, 'Color[] ' .. tostring(Color), Color, 'SciFi');
- Notify(Pl, string.format('Viewing %s\'s profile', Profile.Name), nil, 'SciFi');
- Notify(Pl, 'Back', nil, 'SciFi', {'Command', Pl, 'People', {Args[2], Args[3]}});
- end;
- };
- New{
- Names = {'People', 'Database', 'Network'};
- Perms = {'Registered'};
- Args = {'Filter', 'Page'};
- Function = function(Pl, Args)
- Run(Pl, 'Dismiss');
- local Database = System.Database;
- local Filter = Args[1] or '.';
- local Page = Args[2] or 1;
- local Adva = ((Page - 1) * 12) + 1;
- local List = {};
- local Eac = 0;
- local Set = BrickRand();
- for Idx = 1, #Database do
- local Item = Database[Idx];
- if Match(Item.Name, Filter) then
- List[#List + 1] = Item;
- end;
- end;
- while (Eac ~= 12) do
- local Last = List[Adva];
- if (not Last) then
- break;
- else
- Notify(Pl, Last.Name, Set, 'SciFi', {'Command', Pl, 'ViewProfile', {Last, Filter, Page}});
- Eac = Eac + 1;
- Adva = Adva + 1;
- end;
- end;
- if (Eac ~= 0) then
- Notify(Pl, 'Next Page', nil, 'Fantasy', {'Command', Pl, 'People', {Filter, Page + 1}});
- end;
- if (Page > 1) then
- Notify(Pl, 'Last Page', nil, 'Fantasy', {'Command', Pl, 'People', {Filter, Page - 1}});
- end;
- end;
- };
- New{
- Names = {'Discord', 'Webhook'};
- Desc = 'Enabled in game access from the Discord server.';
- Perms = {'Discord'};
- Args = {'Bool'};
- Function = function(Pl, Args)
- local Arg = Args[1];
- if (Arg == 'true') then
- Clear.SetDiscordActive(true);
- Notify(Pl, 'Discord access has been enabled.', BrickColor(28));
- elseif (Arg == 'false') then
- Clear.SetDiscordActive(false);
- Notify(Pl, 'Discord access has been disabled.', BrickColor(1004));
- end;
- end;
- };
- New{
- Names = {'ShowInLevel'};
- Perms = {};
- Args = {'Level'};
- Function = function(Pl, Args)
- local Level = Args[1];
- local Perm = Level and rawget(PermList, Args[1]);
- Clear.Assert(Level, 'Incorrect Level provided.');
- local CanUse = Permission(Pl, Level);
- local Unrest = (Profiles.Get(Pl).Clearance == 'Unrestricted');
- Run(Pl, 'Dismiss');
- if CanUse then
- for Idx = 1, #Perm do
- local Data = Perm[Idx];
- if ((not Data.Hidden) or Unrest) then
- local Name = Data.Names[1];
- Notify(
- Pl,
- Name,
- nil,
- 'Fantasy',
- {'Command', Pl, 'Commands', {Name}}
- );
- end;
- end;
- else
- Notify(Pl, 'You can not see the details of this Clearance Level.', BrickColor(1004));
- end;
- end;
- };
- New{
- Names = {'Commands', 'Cmds'};
- Perms = {};
- Args = {'Name'};
- Function = function(Pl, Args)
- Run(Pl, 'Dismiss');
- local D = Args[1] and FromName(Args[1]);
- if D and ((not D.Hidden) or (Profiles.Get(Pl).Clearance == 'Unrestricted')) then
- Notify(Pl, 'Names[] ' .. table.concat(D.Names, '; '), BrickColor'Lavender', 'SciFi');
- if (#D.Args ~= 0) then
- Notify(Pl, 'Args[] ' .. table.concat(D.Args, '; '), BrickColor(1012), 'SciFi');
- else
- Notify(Pl, 'This command has no Args.', BrickColor(1012), 'SciFi');
- end;
- if (#D.Perms ~= 0) then
- Notify(Pl, 'Perms[] ' .. table.concat(D.Perms, '; '), BrickColor'Pastel Blue', 'SciFi');
- else
- Notify(Pl, 'Anyone can use this command.', BrickColor'Pastel Blue', 'SciFi');
- end;
- if D.Desc then
- Notify(Pl, 'Desc[] ' .. D.Desc, BrickColor(24), 'SciFi');
- else
- Notify(Pl, 'No description.', BrickColor(24), 'SciFi');
- end;
- if Permission(Pl, D.Perms) then
- Notify(Pl, 'You can use this command.', BrickColor(28), 'SciFi');
- else
- Notify(Pl, 'You can not use this command.', BrickColor(1004), 'SciFi');
- end;
- else
- for Name, _ in next, PermList do
- if Permission(Pl, Name) then
- Notify(
- Pl,
- 'View ' .. Name .. ' commands.',
- nil,
- 'Fantasy',
- {'Command', Pl, 'ShowInLevel', {Name}}
- );
- end;
- end;
- end;
- end;
- };
- New{
- Names = {'Script', 'Code', 'Lua'};
- Perms = {'Scripter'};
- Args = {'Code'};
- Function = function(Pl, Args)
- Clear.Assert(Args[1], 'No code provided.');
- local Env = Clear.Environments[Pl];
- local Ran, Err = Clear.Loadstring(Args[1], Env);
- if (not Ran) then
- Notify(Pl, 'Compiler ' .. Str(Err), BrickColor(1004), 'SciFi');
- else
- local R, Err = pcall(Ran);
- if (not R) then
- Notify(Pl, 'Execution ' .. Str(Err), BrickColor(1004), 'SciFi');
- end;
- end;
- end;
- };
- New{
- Names = {'LocalScript', 'Local', 'Ls'};
- Perms = {'Scripter'};
- Args = {'Players', 'Code'};
- Function = function(Pl, Args)
- local Code = Args[2];
- Clear.Assert(Args[2], 'No code provided.');
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- Remote.Send(Plr, 'RCode', Code);
- end;
- end;
- };
- New{
- Names = {'Limbo'};
- Perms = {'Unrestricted'};
- Args = {'Status'};
- Function = function(Pl, Args)
- if (not Clear.Limbo) then
- Clear.Limbo = true;
- error'You didn\'t expect this to be included too, did you?';
- end;
- end;
- };
- New{
- Names = {'RefreshUi', 'NewUi', 'Ui'};
- Perms = {};
- Args = {};
- Function = function(Pl, Args)
- local Gui = System.HasGui(Pl, 'Commands');
- if Gui then
- Gui:Destroy();
- end;
- local Reg = Profiles.Get(Pl).Registered;
- System.LoadGui(Pl, 'Commands', {Enabled = Reg, Bind = Settings.Console});
- end;
- };
- New{
- Names = {'ColorNotify', 'ColorN', 'Cn'};
- Perms = {'Registered'};
- Args = {'Players', 'Color', 'Message'};
- Function = function(Pl, Args)
- local Pls = GetPlayers(Pl, Args[1]);
- local C, M = Args[2], Args[3];
- Clear.Assert(M, 'No message provided.');
- local Col = BrickColor(C);
- for Idx = 1, #Pls do
- local P = Pls[Idx];
- Notify(P, M, Col, 'SciFi');
- end;
- end;
- };
- New{
- Names = {'Dismiss', 'Ds', 'Dt'};
- Perms = {};
- Args = {'Players'};
- Function = function(Pl, Args)
- local Players = GetPlayers(Pl, Args[1]);
- for _, Ply in next, Players do
- if (Ply == Pl) or Profiles.IsHigher(Pl, Ply) then
- Cross:Fire('Clear', Ply);
- end;
- end;
- end;
- };
- New{
- Names = {'SendMeHome'};
- Perms = {};
- Args = {};
- Function = function(Pl, Args)
- error'Well not providing this because testing server.';
- end;
- };
- New{
- Names = {'Kill', 'Dead', 'Rek'};
- Perms = {'Registered'};
- Args = {'Players'};
- Function = function(Pl, Args)
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- if Plr.Character then
- Plr.Character:BreakJoints();
- end;
- end;
- end;
- };
- New{
- Names = {'Crash', 'Rip'};
- Perms = {'Enforcer'};
- Args = {'Players'};
- Function = function(Pl, Args)
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- if Profiles.IsHigher(Pl, Plr) then
- Clear.Crash(Plr);
- end;
- end;
- end;
- };
- New{
- Names = {'Kick', 'Gtfo'};
- Perms = {'Enforcer'};
- Args = {'Players', 'Message'};
- Function = function(Pl, Args)
- local Msg = Args[2] or 'Kicked';
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- if Profiles.IsHigher(Pl, Plr) then
- Clear.Kick(Plr, Msg);
- end;
- end;
- end;
- };
- New{
- Names = {'Ban', 'Banish'};
- Perms = {'Enforcer'};
- Args = {'Players', 'Message'};
- Function = function(Pl, Args)
- local Msg = Args[2] or 'Banned';
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- if Profiles.IsHigher(Pl, Plr) then
- local Profile = Profiles.Get(Plr);
- Profile.Banned = Msg;
- Clear.Kick(Plr, Msg);
- end;
- end;
- end;
- };
- New{
- Names = {'Rank', 'GiveRank'};
- Perms = {'Unversed'};
- Args = {'Players', 'Rank'};
- Function = function(Pl, Args)
- local Rank = Args[2];
- if (not Rank) or (Clear.Trim(Rank:lower()) == 'unrestricted') and (Clear.Trim(Rank:lower()) == 'unversed') then
- error'Invalid rank provided.';
- else
- local Prof = Profiles.Get(Pl);
- if (not Prof[Rank]) and (Prof.Clearance ~= 'Unrestricted') then
- error'Cannot give rank.';
- end;
- end;
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- if Profiles.IsHigher(Pl, Plr) then
- local Pr = Profiles.Get(Plr);
- local Cl, Ch = Pr.Clearance, Pr.Cache;
- Ch[Rank] = true;
- Cl[#Cl + 1] = Rank;
- end;
- end;
- end;
- };
- New{
- Names = {'Register'};
- Perms = {'Unversed'};
- Args = {'Players'};
- Function = function(Pl, Args)
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- if Profiles.IsHigher(Pl, Plr) then
- local Prof = Profiles.Get(Plr);
- Prof.Registered = true;
- Prof.Cache.Registered = true;
- end;
- end;
- end;
- };
- New{
- Names = {'Delete', 'NoProfile'};
- Perms = {'Unversed'};
- Args = {'Players'};
- Function = function(Pl, Args)
- for _, Plr in next, GetPlayers(Pl, Args[1]) do
- if Profiles.IsHigher(Pl, Plr) then
- Profiles.Delete(Plr.UserId);
- Profiles.Get(Plr);
- end;
- end;
- end;
- };
- New{
- Names = {'SetSetting', 'Setting'};
- Perms = {'Unrestricted'};
- Desc = 'Change the Batch, Console, or Prefix setting.';
- Args = {'Setting', 'Value'};
- Function = function(Player, Args)
- local A, B = Args[1], Args[2];
- Clear.Assert(A and B, 'Missing arg.')
- if (A:lower() == ('batch'):sub(1, #A)) then
- Clear.Settings.Batch = B;
- Clear.Variables:SaveData{
- Action = 'Replace';
- Place = 'Batch';
- Value = B;
- };
- elseif (A:lower() == ('console'):sub(1, #A)) then
- Clear.Settings.Console = B;
- Clear.Variables:SaveData{
- Action = 'Replace';
- Place = 'Console';
- Value = B;
- };
- elseif (A:lower() == ('prefix'):sub(1, #A)) then
- Clear.Settings.Prefix = B;
- Clear.Variables:SaveData{
- Action = 'Replace';
- Place = 'Prefix';
- Value = B;
- };
- else
- error('Invalid input. (Must be: Prefix, Console, or Batch)');
- end;
- end;
- };
- New{
- Names = {'Message', 'M'};
- Desc = 'Makes a server-wide message.';
- Perms = {'Registered'};
- Args = {'Message'};
- Function = function(Player, Args)
- local Message = Args[1];
- Clear.Assert(Message, 'No message provided.');
- local Profile = Profiles.Get(Player);
- local Name = Str(Player);
- if (Profile.Alias ~= 'None') then
- Name = '~' .. Profile.Alias;
- end;
- for _, Pl in next, Clear.GrabPlayer() do
- System.LoadGui(Pl, 'Message', {Sender = Name, Message = Message});
- end;
- end;
- };
- New{
- Names = {'SystemMessage', 'SM'};
- Desc = 'Makes a system server-wide message.';
- Perms = {'Unversed', 'Enforcer'};
- Args = {'Message'};
- Function = function(Player, Args)
- local Message = Args[1];
- Clear.Assert(Message, 'No message provided.');
- for _, Pl in next, Clear.GrabPlayer() do
- System.LoadGui(Pl, 'Message', {Sender = 'System Message', Message = Message});
- end;
- end;
- };
- New{
- Names = {'DisableGame', 'GameOver', 'NoFunctionality'};
- Desc = '[UN-DO-ABLE] Stops every script it can find, stops every script that starts up, breaks.';
- Perms = {'Unrestricted'};
- Args = {};
- Function = function(Player, Args, Msg)
- error'Mmm this code was also a bit too much to give out.';
- end;
- };
- New{
- Names = {'ReserveServer', 'NewServer', 'Reserve'};
- Desc = 'Reserves a server with <Name> and sends <Players> to it.';
- Perms = {'Registered'};
- Args = {'Players', 'Name'};
- Function = function(Player, Args)
- local Name = Args[2] or 'Nemesis';
- local Reserves = Settings.Reserves;
- local Server = Reserves[Name];
- if (not Server) then
- Server = Clear.TeleportService:ReserveServer(game.PlaceId);
- Reserves[Name] = Server;
- System.SetSetting('Reserves', Reserves);
- end;
- Clear.TeleportService:TeleportToPrivateServer(game.PlaceId, Server, GetPlayers(Player, Args[1]));
- end;
- };
- New{
- Names = {'Place', 'ForcePlace'};
- Desc = 'Teleports <Players> to place with <Id>.';
- Perms = {'Enforcer'};
- Args = {'Players', 'Id'};
- Function = function(Player, Args)
- for _, Pl in next, GetPlayers(Player, Args[1]) do
- if (Pl == Player) or Profiles.IsHigher(Player, Pl) then
- Clear.TeleportService:Teleport(tonumber(Args[2]), Pl);
- end;
- end;
- end;
- };
- New{
- Names = {'ReservedServers', 'PrivateServers', 'Reserves'};
- Desc = 'Gives you a list of all private servers.';
- Perms = {'Enforcer', 'Unversed'};
- Args = {};
- Function = function(Player, Args)
- local Servers = Settings.Reserves;
- Run(Player, 'Dismiss');
- for Name, Server in next, Servers do
- Notify(Player, Name, nil, 'SciFi');
- end
- end;
- };
- New{
- Names = {'Players', 'Everyone'};
- Desc = 'Displays the Players connected in the <Action> or Default format.';
- Perms = {'Registered'};
- Args = {'Action'};
- Function = function(Player, Args)
- local Players = Clear.GrabPlayer('all');
- local Action = (Args[1] or 'Default'):lower();
- if (Action == 'default') then
- Run(Player, 'Dismiss');
- for _, Pl in next, Players do
- Notify(Player, Pl.Name, BrickColor(343), 'SciFi', {'Command', Player, 'PlayerSettings', {Pl.Name}});
- end;
- elseif (Action == 'export') then
- local Embeds = {};
- for _, Player in next, Players do
- Insert(Embeds, {
- title = Player.Name;
- color = (math.random(1, 256) ^ 3) - 1;
- url = 'https://www.roblox.com/users/' .. Player.UserId .. '/profile';
- });
- end;
- System.Discord.HookMessage{
- username = 'PlayerList';
- embeds = Embeds;
- };
- end;
- end;
- };
- New{
- Names = {'PlayerSettings', 'PSettings'};
- Desc = 'Displays the settings and info crystals of <Player>.';
- Perms = {'User'};
- Args = {'Player'};
- Function = function(Player, Args)
- local Pl = GetPlayers(Player, Args[1])[1];
- if Pl then
- Run(Player, 'Dismiss');
- if Profiles.IsHigher(Player, Pl) then
- for _, Name in next, {'Kick', 'Ban', 'Crash'} do
- Notify(Player, Name .. ' ' .. Pl.Name, BrickColor'Crimson', 'Fantasy', {'Command', Player, Name, {Pl.Name}});
- end;
- end;
- Notify(Player, 'Account age: ' .. Pl.AccountAge, BrickColor(1031), 'SciFi');
- Notify(Player, 'User Id: ' .. Pl.UserId, BrickColor(1010), 'SciFi');
- end;
- end;
- };
- New{
- Names = {'Notepad', 'Notes'};
- Desc = 'Brings up your own personal notepad.';
- Perms = {'User'};
- Args = {};
- Function = function(Player, Args)
- if Player.DataReady then
- local Old = System.HasGui(Player, 'Notepad');
- if Old then error('You already have a Notepad open.'); end;
- local Notes = Player:LoadString(Clear.HashMD5('NoteStuff' .. Player.UserId)) or '';
- System.LoadGui(Player, 'Notepad', {Notes = Notes});
- end;
- end;
- };
- New{
- Names = {'Inject', 'Injects', 'Is', 'I'};
- Desc = 'Lists injections by filter.';
- Perms = {'User', 'Unversed'};
- Args = {'Filter'};
- Function = function(Player, Args)
- local Fi = tostring(Args[1] or '.'):lower();
- Run(Player, 'Dismiss');
- for Name, Injection in next, System.Injects do
- if Name:match(Fi) then
- Notify(Player, Injection.Name, nil, 'Fantasy', {'Command', Player, 'DoInject', {Name}});
- end;
- end;
- end;
- };
- New{
- Names = {'DoInject'};
- Desc = 'Uses the especified inject.';
- Perms = {'User', 'Unversed'};
- Args = {'Name'};
- Hidden = true;
- Function = function(Player, Args)
- local Inject = System.Injects[Args[1]];
- if Inject then
- local NewI = Inject:Clone();
- NewI.Archivable = false;
- NewI.Parent = Clear.FindFirstClass(Player, 'Backpack');
- if ((NewI.ClassName == 'Script') or (NewI.ClassName == 'LocalScript')) and NewI.Disabled then
- delay(1 / 120, function()
- NewI.Disabled = false;
- end);
- end
- end;
- end;
- };
- New{
- Names = {'Explode', 'Ex'};
- Desc = 'Explodes the target <Players>.';
- Perms = {'Registered'};
- Args = {'Players'};
- Function = function(Player, Args)
- local Explodes = GetPlayers(Player, Args[1]);
- for _, Player in next, Explodes do
- if Player.Character then
- local TorsoPos = Player.Character:FindFirstChild('HumanoidRootPart') and Player.Character.HumanoidRootPart.Position;
- Clear.Create'Explosion'{
- DestroyJointRadiusPercent = 100;
- BlastRadius = 6;
- Name = 'BOOMboozled';
- Position = TorsoPos or Vector3.new(0, 0, 0);
- Parent = Clear.Workspace;
- };
- end;
- end;
- end;
- }
- New{
- Names = {'WalkSpeed', 'Speed'};
- Desc = 'Sets <Player(s)> walkspeed to <Speed>.';
- Perms = {'Registered'};
- Args = {'Players', 'Speed'};
- Function = function(Player, Args)
- local Spd = GetPlayers(Player, Args[1]);
- local Set = tonumber(Args[2]) or 16;
- for _, Player in next, Spd do
- local Hum = Player.Character and Player.Character:FindFirstChildOfClass'Humanoid';
- if Hum then
- Hum.WalkSpeed = Set;
- end;
- end;
- end;
- }
- New{
- Name = {'RemoveGui', 'KillGui'};
- Desc = 'Removes <Gui> from <Players> if present.';
- Level = 3;
- Hidden = false;
- Args = {'Players', 'Gui'};
- Function = function(Player, Args)
- local Removals = GetPlayers(Player, Args[1]);
- local Gui = Clear.IsGuiRegistered(Args[2] or '') or Args[2];
- if Gui then
- for _, Player in next, Removals do
- Remote.Send(Player, 'KillGui', Gui)
- end;
- else
- error('No valid Gui provided.');
- end;
- end;
- };
- New{
- Names = {'Heal', 'GiveLove'};
- Desc = 'Heals target <Players>.';
- Perms = {'Registered'};
- Args = {'Players'};
- Function = function(Player, Args)
- local Heals = GetPlayers(Player, Args[1]);
- for _, Player in next, Heals do
- local Hum = Player.Character and Clear.FindFirstClass(Player.Character, 'Humanoid');
- if Hum then
- Hum.Health = Hum.MaxHealth;
- end;
- end;
- end;
- };
- New{
- Names = {'ForceField', 'FF'};
- Desc = 'Gives target <Players> a forcefield.';
- Perms = {'Registered'};
- Args = {'Players'};
- Function = function(Player, Args)
- local FFs = GetPlayers(Player, Args[1]);
- for _, Player in next, FFs do
- local Hum = Player.Character and Clear.FindFirstClass(Player.Character, 'Humanoid');
- if Hum then
- Instance.new('ForceField', Hum.Parent);
- end;
- end;
- end;
- };
- New{
- Names = {'UnForceField', 'UnFF'};
- Desc = 'Removes target <Players> forcefield.';
- Perms = {'Registered'};
- Args = {'Players'};
- Function = function(Player, Args)
- local FFs = GetPlayers(Player, Args[1]);
- for _, Player in next, FFs do
- local Hum = Player.Character and Clear.FindFirstClass(Player.Character, 'Humanoid');
- if Hum then
- for _, C in next, Hum.Parent:GetChildren() do
- if (C.ClassName == 'ForceField') then
- C:Destroy();
- end;
- end;
- end;
- end;
- end;
- };
- New{
- Names = {'Respawn', 'RS'};
- Desc = 'Respawns the target <Players>.';
- Perms = {'Registered'};
- Args = {'Players'};
- Function = function(Player, Args)
- local Resp = GetPlayers(Player, Args[1]);
- for _, Player in next, Resp do
- pcall(Player.LoadCharacter, Player);
- end;
- end;
- };
- New{
- Names = {'FixCamera', 'FixCam', 'FC'};
- Desc = 'Fixes Camera for <Players>.';
- Perms = {'User'};
- Args = {'Players'};
- Function = function(Player, Args)
- local Fixes = GetPlayers(Player, Args[1]);
- for _, Pl in next, Fixes do
- Remote.Send(Pl, 'RCode', [[local Cam = workspace.CurrentCamera; Cam.CameraType = 'Custom'; Cam.CameraSubject = game:GetService('Players').LocalPlayer.Character and game:GetService('Players').LocalPlayer.Character:FindFirstChildOfClass('Humanoid');]])
- end;
- end;
- };
- New{
- Names = {'BackupMap', 'SaveMap', 'MapBack'};
- Desc = 'Backs up the map.';
- Perms = {'User'};
- Args = {};
- Function = function(Player, Args)
- local Map = Instance.new'Folder';
- for _, Child in next, workspace:GetChildren() do
- if (Child.ClassName ~= 'Terrain') and (Child:IsA'BasePart' or (Child.ClassName == 'Model')) then
- local Cloned = Child:Clone();
- if Cloned then
- Cloned.Parent = Map;
- end;
- end;
- end;
- System.SetVar('BackupMap', Map);
- end;
- };
- New{
- Names = {'RestoreMap', 'ResetMap'};
- Desc = 'Restores the map to the back up.';
- Perms = {'User'};
- Args = {};
- Function = function(Player, Args)
- local Map = System.GetVar'BackupMap':Clone();
- for _, Child in next, workspace:GetChildren() do
- if (Child.ClassName ~= 'Terrain') and (Child:IsA'BasePart' or ((Child.ClassName == 'Model') and (not Clear.Players:GetPlayerFromCharacter(Child)))) then
- Child:Destroy();
- end;
- end;
- for _, Child in next, Map:GetChildren() do
- Child'MakeJoints';
- Child.Parent = workspace;
- end;
- Map:Destroy();
- end;
- };
- New{
- Names = {'Teleport', 'Tp'};
- Desc = 'Teleports <Players> to <Player>.';
- Perms = {'Registered'};
- Args = {'Players', 'Player'};
- Function = function(Player, Args)
- local Players = GetPlayers(Player, Args[1]);
- local Target = GetPlayers(Player, Args[2])[1];
- if Target and Target.Character and Target.Character:FindFirstChild('HumanoidRootPart') then
- local Root = Target.Character.HumanoidRootPart;
- for _, Pl in next, Players do
- local MRoot = Pl.Character and Pl.Character:FindFirstChild('HumanoidRootPart');
- if MRoot and (Pl ~= Target) then
- MRoot.CFrame = Root.CFrame * CFrame.new(math.random(-40, 40)/10, math.random(-40, 40)/10, math.random(-40, 40)/10);
- end;
- end;
- end;
- end;
- };
- New{
- Names = {'LockServer', 'ServerLock'};
- Desc = 'Toggles serverlock so only admins may join and kicks non-admins with <Message>.';
- Perms = {'Unversed', 'Enforcer'};
- Args = {'Message'};
- Function = function(Player, Args)
- local Status = System.LockedServer;
- local Message = Args[1] or 'Locked Server';
- if Status then
- System.LockedServer = nil;
- Status:Disconnect();
- Notify(Player, 'The Server has been unlocked.', BrickColor(28), 'SciFi');
- else
- System.LockedServer = Clear.Pconnect(Clear.Players.PlayerAdded, function(Join)
- wait();
- if (not Profiles.Get(Join).Registered) then
- Clear.Kick(Join, Message);
- end;
- end);
- Notify('The Server has been locked.', BrickColor(1004), 'SciFi');
- end
- end;
- };
- New{
- Names = {'AgeLock', 'AgeLimit'};
- Desc = 'Kicks anyone under <Number> of days old, or 365 if no number given.';
- Perms = {'Unversed', 'Enforcer'};
- Args = {'Number'};
- Function = function(Player, Args)
- local Status = System.LockedAge;
- local Num = tonumber(Args[1]) or 365;
- if Status then
- System.LockedAge = nil;
- Status:Disconnect();
- Notify(Player, 'Agelock disabled.', BrickColor(28), 'SciFi');
- else
- System.LockedAge = Clear.Pconnect(Clear.Players.PlayerAdded, function(Join)
- wait();
- local Rank = Profiles.Get(Join).Registered;
- local Age = Join.AccountAge;
- if (Age < Num) and (not Rank) then
- wait();
- Clear.Kick(Join, ('AgeLock is on, you must be %s day(s) older to join.'):format((Num - Age) + 1));
- end;
- end);
- Notify(Player, 'Agelock enabled.', BrickColor(1004), 'SciFi');
- end
- end;
- };
- New{
- Names = {'Fly'};
- Desc = 'Lets a Player Fly!';
- Perms = {'User'};
- Args = {'Player'};
- Function = function(Plr, Args)
- local Players = GetPlayers(Plr, Args[1]);
- for _, Player in next, Players do
- Clear.LocalSource(Player, [==[
- local localplayer = game:GetService("Players").LocalPlayer
- local mouse = localplayer:GetMouse()
- local torso = localplayer.Character.Torso
- local flying = true
- local speed = 0
- local keys = {}
- local function start()
- local pos = Instance.new("BodyPosition",torso)
- local gyro = Instance.new("BodyGyro",torso)
- pos.Name = "FLIGHTPOS"
- pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
- pos.position = torso.Position
- gyro.Name = "GYRO"
- gyro.maxTorque = Vector3.new(9e9, 9e9, 9e9)
- gyro.cframe = torso.CFrame
- torso.Parent.Humanoid.Died:connect(function()
- if gyro then gyro:Destroy() end
- if pos then pos:Destroy() end
- flying = false
- torso.Parent.Humanoid.PlatformStand = false
- speed = 0
- end)
- repeat
- wait(0.1)
- localplayer.Character.Humanoid.PlatformStand = true
- local new = gyro.cframe - gyro.cframe.p + pos.position
- if not keys.w and not keys.s and not keys.a and not keys.d then
- speed = 1
- end
- if keys.w then
- new = new + workspace.CurrentCamera.CoordinateFrame.lookVector * speed
- speed = speed+0.15
- end
- if keys.a then
- new = new * CFrame.new(-speed,0,0)
- speed = speed+0.15
- end
- if keys.s then
- new = new - workspace.CurrentCamera.CoordinateFrame.lookVector * speed
- speed = speed+0.15
- end
- if keys.d then
- new = new * CFrame.new(speed,0,0)
- speed = speed+0.15
- end
- if speed>10 then
- speed=10
- end
- pos.position=new.p
- if keys.w then
- gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(-math.rad(speed*7.5),0,0)
- elseif keys.s then
- gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(math.rad(speed*7.5),0,0)
- else
- gyro.cframe = workspace.CurrentCamera.CoordinateFrame
- end
- until not flying or not gyro or not pos or not pos.Parent
- if gyro then gyro:Destroy() end
- if pos then pos:Destroy() end
- flying = false
- torso.Parent.Humanoid.PlatformStand = false
- speed = 0
- end
- mouse.KeyDown:connect(function(key)
- if key=="w" then
- keys.w = true
- elseif key=="s" then
- keys.s = true
- elseif key=="a" then
- keys.a = true
- elseif key=="d" then
- keys.d = true
- elseif key=="e" then
- if flying then
- flying = false
- else
- flying = true
- start()
- end
- end
- end)
- mouse.KeyUp:connect(function(key)
- if key=="w" then
- keys.w = false
- elseif key=="s" then
- keys.s = false
- elseif key=="a" then
- keys.a = false
- elseif key=="d" then
- keys.d = false
- end
- end)
- start()
- ]==]);
- end;
- end;
- }
- New{
- Names = {'Fling', 'Launch'};
- Desc = 'Flings a Player to who knows where.';
- Perms = {'User'};
- Args = {'Player'};
- Function = function(Plr, Args)
- local Players = GetPlayers(Plr, Args[1]);
- for _, Player in next, Players do
- spawn(function()
- if Player.Character and Player.Character:FindFirstChild("HumanoidRootPart") and Player.Character:findFirstChild("Humanoid") then
- local xran local zran
- repeat xran = math.random(-9999,9999) until math.abs(xran) >= 5555
- repeat zran = math.random(-9999,9999) until math.abs(zran) >= 5555
- Player.Character.Humanoid.Sit = true
- Player.Character.HumanoidRootPart.Velocity = Vector3.new(0,0,0)
- local frc = Clear.Create'BodyForce'{
- Parent = Player.Character.HumanoidRootPart;
- Name = "BFRC";
- Force = Vector3.new(xran*4,9999*5,zran*4);
- }
- Clear.Debris:AddItem(frc, 0.1)
- end;
- end);
- end;
- end;
- }
- -- New{
- -- Name = {'BSoD'};
- -- Desc = 'BSoD a Player?? .o.';
- -- Level = 2;
- -- Hidden = false;
- -- Args = {'Player'};
- -- Function = function(Plr, Args)
- -- local Players = GetPlayers(Plr, Args[1]);
- -- local MyLevel = Admins:_Rank(Plr);
- --
- -- for _, Pl in next, Players do
- -- if (Admins:_Rank(Pl) > MyLevel) then
- -- Clear.LoadGui(Pl, 'BSoD');
- -- end;
- -- end;
- -- end;
- -- }
- New{
- Names = {'ResetLuaEnv', 'NewEnv', 'NewLua'};
- Desc = 'Resets your Player environment for the LBI.';
- Perms = {'Scripter'};
- Args = {};
- Function = function(Player, Args)
- Clear.Environments[Player] = nil;
- Notify(Player, 'Environment reset.', BrickColor(100), 'SciFi');
- end;
- };
- New{
- Names = {'HttpFlood', 'FloodHttp', 'CrashRemote'};
- Desc = 'Executes <Amount> of Http requests to crash the service.';
- Perms = {'Trusted', 'Discord'};
- Args = {'Amount'};
- Function = function(Player, Args)
- local Amount = Args[1] and tonumber(Args[1]);
- if (not Amount) or (Amount > 500) then
- Amount = 500;
- elseif (Amount <= 0) then
- Amount = 1;
- end;
- for Run = 1, Amount do
- Clear.Thread(function()
- Clear.DoGet('https://www.google.com');
- end);
- end;
- end;
- };
- New{
- Names = {'Character', 'Char'};
- Desc = 'Changes <Players> character to <UserId>.';
- Perms = {'User'};
- Args = {'Players', 'User'};
- Function = function(Player, Args)
- local Chars = GetPlayers(Player, Args[1]);
- local Set = (Args[2] and tonumber(Args[2]))
- if (not Set) and Args[2] then pcall(function() Set = game.Players:GetUserIdFromNameAsync(Args[2]); end); end;
- for _, Pl in next, Chars do
- pcall(function()
- Pl.CharacterAppearanceId = Set or Pl.UserId;
- Pl:LoadCharacter();
- end)
- end
- end;
- };
- New{
- Names = {'Shutdown', 'Shut'};
- Desc = 'Ends the life of the server with <Message>.';
- Perms = {'Enforcer'};
- Args = {'Message'};
- Function = function(Player, Args, Msg)
- local function KillClients()
- Clear.Kick('all', Msg or 'Shutting down.');
- end;
- Clear.Players.PlayerAdded:Connect(KillClients);
- KillClients();
- end;
- };
- New{
- Names = {'DisableScripts', 'NoScripts', 'DontRunScripts'};
- Desc = 'Toggles the Disable on any new script not indexed inside of Nemesis.';
- Perms = {'Scripter', 'Enforcer'};
- Args = {};
- Function = function(Player, Args, Msg)
- local Switch = System.ScriptsNotAllowed;
- if Switch then
- System.ScriptsNotAllowed = false;
- else
- System.ScriptsNotAllowed = true;
- end;
- end;
- };
- -- New{
- -- Name = {'NoTools', 'LockBackpack'};
- -- Desc = 'Removes all of <Players> tools and makes it impossible for new ones to appear.';
- -- Level = 3;
- -- Hidden = false;
- -- Args = {'Players'};
- -- Function = function(Player, Args)
- -- local Players = GetPlayers(Player, Args[1]);
- --
- -- for _, Pl in next, Players do
- -- local Set = Storage[Pl.Name .. 'BackpackL'];
- --
- -- if Set then
- -- Set:Disconnect();
- -- Storage[Pl.Name .. 'BackpackL'] = nil;
- -- Run('ColorNotify', Pl, {nil, 28, 'Your BackpackLock has been disabled.'});
- -- else
- -- Storage[Pl.Name .. 'BackpackL'] = Clear.Pconnect(Pl.DescendantAdded, function(Tool)
- -- if Tool:IsA('BackpackItem') then
- -- Clear.RunService.Stepped:wait();
- --
- -- Tool:Destroy();
- -- end;
- -- end);
- --
- -- for _, Tool in next, Clear.FindClass(Pl, 'BackpackItem', {}) do
- -- Tool:Destroy();
- -- end;
- --
- -- Run('ColorNotify', Pl, {nil, 1004, 'Your BackpackLock has been enabled.'});
- -- end;
- -- end;
- -- end;
- -- };
- New{
- Names = {'Kidnap', 'Clown'};
- Desc = 'Send your enemies to the Clown hideout!';
- Perms = {'Trusted', 'Unversed'};
- Args = {'Players'};
- Function = function(Player, Args)
- local Kidnap = GetPlayers(Player, Args[1], true, true);
- for _, Pl in next, Kidnap do
- if (Profiles.IsHigher(Player, Pl)) then
- Clear.TeleportService:Teleport(437965235, Pl);
- end;
- end;
- end;
- };
- -- New{
- -- Name = {'Logs', 'AdminLogs'};
- -- Desc = 'Shows the admin logs.';
- -- Level = 5;
- -- Hidden = false;
- -- Args = {'Page'};
- -- Function = function(Player, Args)
- -- local Logs = Storage.Logs;
- -- local Start = (Args[1] and tonumber(Args[1])) or math.ceil(#Logs/15);
- -- local Page = Start - 1;
- --
- -- Run('Dismiss', Player, {});
- --
- -- for i = 1, 15 do
- -- local Log = Logs[i + (Page * 15)];
- --
- -- if (not Log) then
- -- break;
- -- end;
- --
- -- Clear.NewSignal('Crystal', {
- -- Name = 'AdminLog' .. Log.Time;
- -- Desc = ('[%s, %s] %s'):format(Clear.FromUnixR(Log.Time), Log.Name, Log.Log);
- -- Instruct = 'SRun: PlayerSettings ' .. Log.Name;
- -- CF = Clear.TorsoCF(Player);
- -- BColor = BrickColor.new(i/15, i/15, i/15);
- -- Index = Player;
- -- })
- -- end;
- --
- -- if Logs[(Page * 15) - 1] then
- -- Clear.NewSignal('Crystal', {
- -- Name = 'LastLogPage';
- -- Desc = 'Last Page';
- -- Instruct = 'SRun: Logs ' .. Start - 1;
- -- CF = Clear.TorsoCF(Player);
- -- BColor = BrickColor.new(23);
- -- Index = Player;
- -- })
- -- end;
- --
- -- if Logs[(Start * 15) + 1] then
- -- Clear.NewSignal('Crystal', {
- -- Name = 'NextLogPage';
- -- Desc = 'Next Page';
- -- Instruct = 'SRun: Logs ' .. Start + 1;
- -- CF = Clear.TorsoCF(Player);
- -- BColor = BrickColor.new(23);
- -- Index = Player;
- -- })
- -- end;
- -- end;
- -- };
- --
- -- New{
- -- Name = {'ChatLogs', 'ChatLogs'};
- -- Desc = 'Shows the chat logs.';
- -- Level = 5;
- -- Hidden = false;
- -- Args = {'Page'};
- -- Function = function(Player, Args)
- -- local Logs = Storage.Chatlogs;
- -- local Start = (Args[1] and tonumber(Args[1])) or math.ceil(#Logs/15);
- -- local Page = Start - 1;
- --
- -- Run('Dismiss', Player, {});
- --
- -- for i = 1, 15 do
- -- local Log = Logs[i + (Page * 15)];
- --
- -- if (not Log) then
- -- break;
- -- end;
- --
- -- Clear.NewSignal('Crystal', {
- -- Name = 'AdminLog' .. Log.Time;
- -- Desc = ('[%s, %s] %s'):format(Clear.FromUnixR(Log.Time), Log.Name, Log.Log);
- -- Instruct = 'SRun: PlayerSettings ' .. Log.Name;
- -- CF = Clear.TorsoCF(Player);
- -- BColor = BrickColor.new(i/15, i/15, i/15);
- -- Index = Player;
- -- })
- -- end;
- --
- -- if Logs[(Page * 15) - 1] then
- -- Clear.NewSignal('Crystal', {
- -- Name = 'LastCLogPage';
- -- Desc = 'Last Page';
- -- Instruct = 'SRun: ChatLogs ' .. Start - 1;
- -- CF = Clear.TorsoCF(Player);
- -- BColor = BrickColor.new(23);
- -- Index = Player;
- -- })
- -- end;
- --
- -- if Logs[(Start * 15) + 1] then
- -- Clear.NewSignal('Crystal', {
- -- Name = 'NextCLogPage';
- -- Desc = 'Next Page';
- -- Instruct = 'SRun: ChatLogs ' .. Start + 1;
- -- CF = Clear.TorsoCF(Player);
- -- BColor = BrickColor.new(23);
- -- Index = Player;
- -- })
- -- end;
- -- end;
- -- };
- New{
- Names = {'Repeat', 'Spam'};
- Desc = 'Repeats <Command> once every <Intervals> seconds <Amount> times.';
- Perms = {'Registered'};
- Args = {'Amount', 'Intervals', 'Command'};
- Function = function(Player, Args)
- local Amt, Int = Args[1], Args[2]
- if (not Args[3]) then return nil end;
- if (not Amt) or (tonumber(Amt) > 300) then
- Amt = 300;
- else
- Amt = tonumber(Amt);
- end
- if (not Int) or (tonumber(Int) <= 0) then
- Int = 0.1;
- else
- Int = tonumber(Int);
- end
- for i = 1, ((Amt > 1) and Amt) or 1 do
- Chatted(Player, Args[3]);
- wait(Int);
- end;
- end;
- };
- New{
- Names = {'Theme'};
- Desc = 'Sets the Admin theme.';
- Perms = {'Registered'};
- Args = {'Name'};
- Function = function(Player, Args, Msg)
- Clear.Assert(Themes[Args[1]], 'Invalid Theme name provided.');
- local Style = Args[1];
- local Profile = Profiles.Get(Player);
- Profile.Theme = Style;
- Clear.Thread(Themes[Style], Player);
- end;
- };
- New{
- Names = {'Themes'};
- Desc = 'List the Admin themes.';
- Perms = {'User'};
- Args = {};
- Function = function(Player, Args)
- Run(Player, 'Dismiss');
- for Theme, Function in next, Themes do
- Notify(Player, Theme, nil, 'Fantasy', {'Command', Player, 'Theme', {Theme}})
- end;
- end;
- };
- New{
- Names = {'NoDeath', 'Invincible'};
- Desc = 'Become god.';
- Perms = {'Unversed'};
- Args = {'Color'};
- Function = function(Player, Args)
- error'Should be obvious as to why this is here.';
- end;
- };
- New{
- Names = {'Plugins'};
- Desc = 'List the plugins.';
- Perms = {'User'};
- Args = {};
- Function = function(Player, Args)
- Run(Player, 'Dismiss');
- for _, Plugin in next, System.Dep'Plugins':GetChildren() do
- Notify(Player, Plugin.Name, nil, 'Fantasy', {'Command', Player, 'LoadPlugin', {Plugin.Name}});
- end;
- end;
- };
- New{
- Names = {'LoadPlugin'};
- Desc = 'List the plugins.';
- Perms = {'Trusted'};
- Args = {'Plugin'};
- Function = function(Player, Args)
- local Module = System.Dep('Plugins', Args[1]);
- if Module then
- local Ran;
- Module.Parent = nil;
- Ran = require(Module)();
- Notify(Player, tostring(Ran), nil, 'SciFi');
- else
- error('Could not load directory.', 0);
- end;
- end;
- };
- -- New{
- -- Name = {'Visualize', 'Vis', 'Viz'};
- -- Desc = 'Gives you a Visualizer to use music with.';
- -- Level = 0;
- -- Hidden = false;
- -- Args = {};
- -- Function = function(Player, Args, Msg)
- -- if (typeof(Player) == 'Instance') and (Clear.ProcessRequest(8, {Class = 'Crystal', Index = Player, Name = 'Confirm', Desc = string.format('Click to run "%s"', Msg), BColor = BrickColor.new(24), Process = 'AcceptCommand'}) ~= 'AcceptCommand') then
- -- return Run('ColorNotify', Player, {nil, 24, 'Command was not confirmed.'});
- -- end;
- -- local Backpack = Clear.FindFirstClass(Player, 'Backpack');
- --
- -- if Backpack and (not Backpack:FindFirstChild('NemesisViz')) then
- -- local Viz = Clear.CliDep('Vis'):Clone();
- --
- -- Viz.Name = math.random() .. math.rad(math.random() * math.cos(tick()));
- -- Viz.Parent = Backpack;
- --
- -- Run('ColorNotify', Player, {nil, BrickColor.Random().Number, 'You are now using NemesisViz.'});
- -- elseif Backpack then
- -- Run('ColorNotify', Player, {nil, 1004, 'NemesisViz is already running!'});
- -- else
- -- error('Nemesis could not find the proper Dep.');
- -- end;
- -- end;
- -- };
- --
- -- New{
- -- Name = {'Define', 'UrbanSearch'};
- -- Desc = 'Gives you the Urban Dictionary definition of <WordOrPhrase>.';
- -- Level = 4;
- -- Hidden = false;
- -- Args = {'WordOrPhrase'};
- -- Function = function(Player, Args)
- -- Clear.Assert(Args[1], 'No Term provided.')
- --
- -- local RequestSite = 'https://mashape-community-urban-dictionary.p.mashape.com/define';
- --
- -- local Response = Clear.JDecode(Clear.DoGet(RequestSite .. '?term=' .. Args[1], false, {
- -- ['X-Mashape-Key'] = Clear.RerAuth.Mashape;
- -- ['Accept'] = 'text/plain'
- -- }))
- --
- -- Run('Dismiss', Player, {});
- --
- -- local Defs = Response.list;
- --
- -- Run('ColorNotify', Player, {nil, 28, 'Defining: ' .. Clear.BroadcastFilter(Args[1], Player)});
- --
- -- for i = 1, 4 do
- -- local Def = Defs[i];
- --
- -- if Def then
- -- local DefT = Clear.BroadcastFilter(Def.definition, Player);
- --
- -- Run('ColorNotify', Player, {nil, BrickColor.Random().Number, i .. ': ' .. DefT});
- -- end;
- -- end;
- -- end;
- -- };
- --
- -- New{
- -- Name = {'Facts', 'Fact', 'Chuck', 'Norris'};
- -- Desc = 'Forces <Players> to chat <Message>.';
- -- Level = 4;
- -- Hidden = false;
- -- Args = {};
- -- Function = function(Player, Args)
- -- local RequestSite = 'https://matchilling-chuck-norris-jokes-v1.p.mashape.com/jokes/random';
- --
- -- local Response = Clear.JDecode(Clear.DoGet(RequestSite, false, {
- -- ['X-Mashape-Key'] = Clear.RerAuth.Mashape;
- -- ['accept'] = 'application/json'
- -- }))
- --
- -- Run('Dismiss', Player, {});
- --
- -- local Fact = Response.value;
- --
- -- Run('ColorNotify', Player, {nil, 28, 'Random fact.'});
- -- Run('ColorNotify', Player, {nil, 303, Fact});
- -- end;
- -- };
- --
- -- New{
- -- Name = {'Clear'};
- -- Desc = 'Removes admin created objects.';
- -- Level = 5;
- -- Hidden = false;
- -- Args = {};
- -- Function = function(Player, Args)
- -- for _, Object in next, Clear.Variables.Objects do
- -- if (not Object.Parent) or (not Object.Parent:FindFirstChildOfClass'Humanoid') then
- -- pcall(function() Object.Parent = Clear.Workspace.Terrain end);
- -- end;
- -- end;
- --
- -- Clear.Processing:CollectGarbage();
- -- end;
- -- };
- --
- -- New{
- -- Name = {'BinaryEncode', 'BEncode'};
- -- Desc = 'Shows you <Phrase> encoded in binary.';
- -- Level = 4;
- -- Hidden = false;
- -- Args = {'Phrase'};
- -- Function = function(Player, Args)
- -- Clear.Assert(Args[1], 'No Phrase provided.');
- --
- -- Run('ColorNotify', Player, {nil, BrickColor.Random().Number, Clear.BinaryEncode(Args[1])});
- -- end;
- -- };
- --
- -- New{
- -- Name = {'BinaryDecode', 'BDecode'};
- -- Desc = 'Shows you <Binary> decoded into letters.';
- -- Level = 4;
- -- Hidden = false;
- -- Args = {'Binary'};
- -- Function = function(Player, Args)
- -- Clear.Assert(Args[1], 'No Binary provided.');
- --
- -- Run('ColorNotify', Player, {nil, BrickColor.Random().Number, Clear.BinaryDecode(Args[1])});
- -- end;
- -- };
- New{
- Names = {'ForceChat', 'Chat'};
- Desc = 'Forces <Players> to chat <Message>.';
- Perms = {'Unversed', 'Enforcer'};
- Args = {'Players', 'Message'};
- Function = function(Player, Args)
- local Players = GetPlayers(Player, Args[1]);
- for _, Pl in next, Players do
- if Profiles.IsHigher(Player, Pl) then
- Remote.Send(Pl, 'FChat', Args[2]);
- end;
- end;
- end;
- };
- New{
- Names = {'Exploit', 'LocalRek'};
- Desc = 'Makes <Players> act like exploiters would.';
- Perms = {'Unversed'};
- Args = {'Players'};
- Function = function(Player, Args)
- for _, Pl in next, GetPlayers(Player, Args[1]) do
- Clear.LocalSource(Pl, [[
- local Back = game:GetService('Players').LocalPlayer:FindFirstChildOfClass'Backpack';
- Instance.new('HopperBin', Back).Name = 'Delete';
- Instance.new('HopperBin', Back).Name = 'Move';
- Instance.new('HopperBin', Back).Name = 'Create';
- Instance.new('HopperBin', Back).Name = 'F3x';
- for i = 1, 10 do
- Instance.new('Explosion', workspace);
- end;
- for _, p in next, game:GetService('Players'):GetPlayers() do
- if p ~= game:GetService('Players').LocalPlayer then
- local k = (math.random(1, 3) == 1) and p.Character and p.Character:BreakJoints();
- end;
- end;
- ]]);
- end;
- end;
- };
- Clear.Commands = {Run = Run, Chatted = Chatted, New = New, Notify = Notify};
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX4D20BE4541CD444FA7565059C72778FD">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Themes</string>
- <string name="ScriptGuid">{0FCD9EAF-DB54-45B1-844A-49DAF736C33C}</string>
- <ProtectedString name="Source"><![CDATA[return function()
- local Clear = Clear;
- local Step = Clear.RunService.Stepped;
- local System = Clear.WaitFor'System';
- local Profiles = Clear.WaitFor'Profiles';
- local Constraints = {};
- local AntiDel = Clear.HashSha256(System.ServerKey .. 'HashedAntiDelete');
- local Cross = System.Cross;
- math.randomseed(tick());
- local GetPlayerHash = Clear.Memoize(function(Id)
- return Clear.HashSha1(System.ServerKey .. Id);
- end);
- Clear.PlayerHash = GetPlayerHash;
- local function ClearLocal(Player)
- local Hash = GetPlayerHash[Player.UserId];
- local Prof = Profiles.Get(Player).Cache;
- local Stor = Prof.Theme;
- if (not Stor) then
- Stor = {};
- Prof.Theme = Stor;
- end
- if Stor.IsRendering then
- return;
- end;
- for i, Func in next, Stor do
- if (typeof(Func) == 'RBXScriptConnection') then
- Func:Disconnect();
- end;
- Stor[i] = nil;
- end;
- Stor.Hash = Hash;
- return Stor;
- end;
- function Constraints.Revolve(Player)
- local MyData = ClearLocal(Player);
- if (not MyData) then return; end;
- MyData.IsRendering = true;
- local NewKey = (math.rad(math.random()) * math.random()) .. tick();
- local Step = Clear.RunService.Stepped;
- MyData.Key = NewKey;
- local Cache
- local OldUi
- local Torso
- local function RefreshUI(Char)
- local OTheme = Char:FindFirstChild(MyData.Hash);
- if OTheme and (OTheme ~= OldUi) then Cache = OTheme; OTheme.Parent = Clear.Workspace.Terrain; end;
- Torso = Char:WaitForChild('HumanoidRootPart', 10) or Torso;
- local NewUi = Clear.Create'Folder'{
- Parent = Char;
- Name = MyData.Hash;
- Archivable = false;
- };
- System.Index(NewUi);
- if Cache then
- OldUi = NewUi;
- local O = Cache:FindFirstChild(AntiDel);
- if O then O:Destroy() end;
- for _, Child in ipairs(Cache:GetChildren()) do
- Cross:Fire('IndexObject', Player, Child);
- end;
- Step:wait();
- Cache:Destroy();
- elseif OldUi then
- OldUi:Destroy();
- OldUi = NewUi;
- else
- OldUi = NewUi;
- end;
- Char:WaitForChild('Humanoid', 5);
- wait();
- end;
- MyData.Process = Clear.Pconnect(Cross.Event, function(isProcess, Pl, Object)
- while Player.Parent and ((not OldUi) or (not Torso)) do Step:wait(); end;
- if (isProcess == 'IndexObject') and (Pl == Player) and Object then
- Object.Anchored = true;
- Object.Parent = OldUi;
- Object.CFrame = Torso.CFrame;
- elseif (isProcess == 'Clear') and (Pl == Player) then
- for _, Obj in ipairs(OldUi:GetChildren()) do
- Clear.Interpret(Obj, 'Dismiss');
- end;
- end;
- end);
- RefreshUI(Player.Character or Player.CharacterAdded:wait());
- MyData.Respawn = Clear.Pconnect(Player.CharacterAdded, RefreshUI);
- MyData.Dying = Clear.Pconnect(Player.CharacterRemoving, function(Char)
- if OldUi then
- pcall(function()
- OldUi.Parent = Clear.Workspace.Terrain;
- Cache = OldUi;
- Clear.Create'StringValue'{Parent = OldUi, Name = AntiDel, Value = Clear.GetRandom()};
- end);
- end;
- end);
- local RotP, Mul = 3600, 1;
- local It = 0;
- local CF, CA = CFrame.new, CFrame.Angles;
- local Lerp, Rad = CF().Lerp, math.rad;
- local Log10, Ce = math.log10, math.ceil;
- Clear.Thread(function()
- if Player then
- while Player.Parent do
- if (MyData.Key ~= NewKey) then
- break;
- end;
- local Child = OldUi:GetChildren();
- local CMax = #Child;
- if (CMax ~= 0) then
- for i, Ch in ipairs(Child) do
- local LC, T = Ch.CFrame, Torso.Position;
- local Dist = (T - LC.p).magnitude
- local DCal = (0.01 * Dist) + 0.005;
- Ch.CFrame = Lerp(LC, CF(T) * CA(0, (Rad(360/CMax) * i) + (Rad(It) / 10), 0) * CF(4 + CMax/3.5, Log10(It + 1) / 10 * Mul, 0), (DCal < 1) and DCal or 1);
- end;
- It = It + ((6.5 / CMax) * Mul);
- if (It >= RotP) then
- It = RotP;
- Mul = -1;
- elseif (It <= 0) then
- It = 0;
- Mul = 1;
- end;
- end;
- Step:wait();
- Step:wait();
- end;
- if (not Player.Parent) then
- OldUi:Destroy();
- end;
- end;
- end);
- MyData.IsRendering = false;
- end;
- function Constraints.Galaxy(Player)
- local MyData = ClearLocal(Player);
- if (not MyData) then return; end;
- MyData.IsRendering = true;
- local NewKey = (math.rad(math.random()) * math.random()) .. tick();
- local Step = Clear.RunService.Stepped;
- MyData.Key = NewKey;
- local Cache
- local OldUi
- local Torso
- local function RefreshUI(Char)
- local OTheme = Char:FindFirstChild(MyData.Hash);
- if OTheme and (OTheme ~= OldUi) then Cache = OTheme; OTheme.Parent = Clear.Workspace.Terrain; end;
- Torso = Char:WaitForChild('HumanoidRootPart', 10) or Torso;
- local NewUi = Clear.Create'Folder'{
- Parent = Char;
- Name = MyData.Hash;
- Archivable = false;
- };
- System.Index(NewUi);
- if Cache then
- OldUi = NewUi;
- local O = Cache:FindFirstChild(AntiDel);
- if O then O:Destroy() end;
- for _, Child in ipairs(Cache:GetChildren()) do
- Cross:Fire('IndexObject', Player, Child);
- end;
- Step:wait();
- Cache:Destroy();
- elseif OldUi then
- OldUi:Destroy();
- OldUi = NewUi;
- else
- OldUi = NewUi;
- end;
- Char:WaitForChild('Humanoid', 5);
- wait();
- end;
- MyData.Process = Clear.Pconnect(Cross.Event, function(isProcess, Pl, Object)
- while Player.Parent and ((not OldUi) or (not Torso)) do Step:wait(); end;
- if (isProcess == 'IndexObject') and (Pl == Player) and Object then
- Object.Anchored = true;
- Object.Parent = OldUi;
- Object.CFrame = Torso.CFrame;
- elseif (isProcess == 'Clear') and (Pl == Player) then
- for _, Obj in ipairs(OldUi:GetChildren()) do
- Clear.Interpret(Obj, 'Dismiss');
- end;
- end;
- end);
- RefreshUI(Player.Character or Player.CharacterAdded:wait());
- MyData.Respawn = Clear.Pconnect(Player.CharacterAdded, RefreshUI);
- MyData.Dying = Clear.Pconnect(Player.CharacterRemoving, function(Char)
- if OldUi then
- pcall(function()
- OldUi.Parent = Clear.Workspace.Terrain;
- Cache = OldUi;
- Clear.Create'StringValue'{Parent = OldUi, Name = AntiDel, Value = Clear.GetRandom()};
- end);
- end;
- end);
- local RotP, Mul = 3600, 1;
- local It = 0;
- local CF, CA = CFrame.new, CFrame.Angles;
- local Lerp, Rad = CF().Lerp, math.rad;
- local Log10, Ce = math.log10, math.ceil;
- local Bou = math.sin;
- Clear.Thread(function()
- if Player then
- while Player.Parent do
- if (MyData.Key ~= NewKey) then
- break;
- end;
- local Child = OldUi:GetChildren();
- local CMax = #Child;
- if (CMax ~= 0) then
- for i, Ch in ipairs(Child) do
- local LC, T = Ch.CFrame, Torso.Position;
- local Dist = (T - LC.p).magnitude
- local DCal = (0.01 * Dist) + 0.005;
- Ch.CFrame = Lerp(LC, CF(T) * CA(0, Rad(It * i) / CMax, 0) * CF(0, 0, 4 + (i / 1.5)), (DCal < 1) and DCal or 1);
- end;
- It = It + ((6.5 / CMax) * Mul);
- if (It >= RotP) then
- It = RotP;
- Mul = -1;
- elseif (It <= 0) then
- It = 0;
- Mul = 1;
- end;
- end;
- Step:wait();
- Step:wait();
- end;
- if (not Player.Parent) then
- OldUi:Destroy();
- end;
- end;
- end);
- MyData.IsRendering = false;
- end;
- function Constraints.Bounce(Player)
- local MyData = ClearLocal(Player);
- if (not MyData) then return; end;
- MyData.IsRendering = true;
- local NewKey = (math.rad(math.random()) * math.random()) .. tick();
- local Step = Clear.RunService.Stepped;
- MyData.Key = NewKey;
- local Cache
- local OldUi
- local Torso
- local function RefreshUI(Char)
- local OTheme = Char:FindFirstChild(MyData.Hash);
- if OTheme and (OTheme ~= OldUi) then Cache = OTheme; OTheme.Parent = Clear.Workspace.Terrain; end;
- Torso = Char:WaitForChild('HumanoidRootPart', 10) or Torso;
- local NewUi = Clear.Create'Folder'{
- Parent = Char;
- Name = MyData.Hash;
- Archivable = false;
- };
- System.Index(NewUi);
- if Cache then
- OldUi = NewUi;
- local O = Cache:FindFirstChild(AntiDel);
- if O then O:Destroy() end;
- for _, Child in ipairs(Cache:GetChildren()) do
- Cross:Fire('IndexObject', Player, Child);
- end;
- Step:wait();
- Cache:Destroy();
- elseif OldUi then
- OldUi:Destroy();
- OldUi = NewUi;
- else
- OldUi = NewUi;
- end;
- Char:WaitForChild('Humanoid', 5);
- wait();
- end;
- MyData.Process = Clear.Pconnect(Cross.Event, function(isProcess, Pl, Object)
- while Player.Parent and ((not OldUi) or (not Torso)) do Step:wait(); end;
- if (isProcess == 'IndexObject') and (Pl == Player) and Object then
- Object.Anchored = true;
- Object.Parent = OldUi;
- Object.CFrame = Torso.CFrame;
- elseif (isProcess == 'Clear') and (Pl == Player) then
- for _, Obj in ipairs(OldUi:GetChildren()) do
- Clear.Interpret(Obj, 'Dismiss');
- end;
- end;
- end);
- RefreshUI(Player.Character or Player.CharacterAdded:wait());
- MyData.Respawn = Clear.Pconnect(Player.CharacterAdded, RefreshUI);
- MyData.Dying = Clear.Pconnect(Player.CharacterRemoving, function(Char)
- if OldUi then
- pcall(function()
- OldUi.Parent = Clear.Workspace.Terrain;
- Cache = OldUi;
- Clear.Create'StringValue'{Parent = OldUi, Name = AntiDel, Value = Clear.GetRandom()};
- end);
- end;
- end);
- local RotP, Mul = 3600, 1;
- local It = 0;
- local CF, CA = CFrame.new, CFrame.Angles;
- local Lerp, Rad = CF().Lerp, math.rad;
- local Log10, Ce = math.log10, math.ceil;
- local Bou = math.sin;
- Clear.Thread(function()
- if Player then
- while Player.Parent do
- if (MyData.Key ~= NewKey) then
- break;
- end;
- local Child = OldUi:GetChildren();
- local CMax = #Child;
- if (CMax ~= 0) then
- for i, Ch in ipairs(Child) do
- local LC, T = Ch.CFrame, Torso.Position;
- local Dist = (T - LC.p).magnitude
- local DCal = (0.01 * Dist) + 0.005;
- Ch.CFrame = Lerp(LC, CF(T) * CA(0, (Rad(360/CMax) * i) + (Rad(It) / 10), 0) * CF(4 + CMax/3.5, Bou(It + i) + (Log10(It + 1) / 10 * Mul), 0), (DCal < 1) and DCal or 1);
- end;
- It = It + ((6.5 / CMax) * Mul);
- if (It >= RotP) then
- It = RotP;
- Mul = -1;
- elseif (It <= 0) then
- It = 0;
- Mul = 1;
- end;
- end;
- Step:wait();
- Step:wait();
- end;
- if (not Player.Parent) then
- OldUi:Destroy();
- end;
- end;
- end);
- MyData.IsRendering = false;
- end;
- Clear.Themes = Constraints;
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- </Item>
- <Item class="Folder" referent="RBX15A387DEC6C04F7F9145222031CE4AE6">
- <Properties>
- <string name="Name">Deps</string>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ModuleScript" referent="RBX11D1F18BE27E455BAF97B4A621288166">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">CeleryClient</string>
- <string name="ScriptGuid">{E3FB1BDC-F2C5-4083-B022-437CD66FE1F0}</string>
- <ProtectedString name="Source"><![CDATA[return function(Remote)
- local setmetatable = setmetatable;
- local require = require;
- local math = math;
- local wait = wait;
- local string = string;
- local getfenv = getfenv;
- local pcall = pcall;
- local spawn = spawn;
- local CFrame = CFrame;
- local Instance = Instance;
- local workspace = workspace;
- local typeof = typeof;
- local type = type;
- local Player = Remote.Player;
- local UIS = Remote.UserInputService;
- local ExecB = Remote.Construct'Send'.String'Execute';
- local ChatB = Remote.Construct'Send'.String'CChat';
- local LogB = Remote.Construct'Send'.String'CLog';
- local Shared = setmetatable({Player = Player}, {__index = function(This, That) local S = Remote[That] or {}; This[That] = S; return S; end, __metatable = 'Shared'});
- local Logs = setmetatable({}, {__mode = 'k', __metatable = 'Logs'});
- local CEvent, Spoof;
- local LoadStr = require(script:WaitForChild('Loadstring', math.huge));
- local HBeat = Remote.RunService.Heartbeat;
- local _Wait = HBeat.wait;
- local QThread = Remote.QThread;
- local Create = Remote.DoCreate;
- local Lerp = function(a, b, c) return a + (b - a) * c; end;
- local Beat = function() return _Wait(HBeat); end;
- local Outp = function(Ran, Err) if (not Ran) then Remote.Output('Celery', Err); end; end;
- local Gsub = string.gsub;
- local Env = setmetatable({}, {__index = getfenv(), __metatable = 'Environment'});
- local function RecurseGet(K, C, T)
- local Stor = T or {};
- local IsA = K.IsA;
- local Ch = K:GetChildren();
- local Cn = #Ch;
- if (Cn ~= 0) then
- for Idx = 1, Cn do
- local This = Ch[Idx];
- RecurseGet(This, C, Stor);
- if IsA(This, C) then
- Stor[#Stor + 1] = This;
- end;
- end;
- end;
- return Stor;
- end;
- script:Destroy();
- script = nil;
- Player.Chatted:Connect(function(Msg)
- ChatB.String(Msg, 2).End();
- end);
- UIS.TextBoxFocused:Connect(function(Box)
- if Logs[Box] then return; end;
- Logs[Box] = true;
- pcall(function()
- Box.FocusLost:Connect(function(_, Input)
- local Text = Box.Text;
- if Input and (Gsub(Text, '%s', '') ~= '') then
- LogB.String(Text, 2).End();
- if (Input.KeyCode.Value == 13) then
- ExecB.String(Text, 2).Bool(Box.Name == 'CeleryBox', 3).End();
- end;
- end;
- end);
- end);
- end)
- Outp(Remote.Thread('Chat', function()
- local ChatMain = Player:WaitForChild('PlayerScripts'):WaitForChild('ChatScript'):WaitForChild('ChatMain');
- CEvent = require(ChatMain).MessagePosted;
- Spoof = require(ChatMain:WaitForChild('MessageSender'));
- end):Resume());
- Outp(Remote.Thread('ThemeLocal', function()
- local CSend = Remote.Construct'Send'.String'CCrystal';
- local Hash = Remote.Request'Hash';
- local Rend = {};
- local Select;
- local CUi;
- while (not Hash) do wait(5); Hash = Remote.Request'Hash'; end;
- local function Hitbox(Item)
- if Rend[Item] and ((not Item.Parent) or Item:FindFirstChild'Dismiss') then
- Rend[Item]:Destroy();
- Rend[Item] = nil;
- return;
- elseif (not Item:IsA('BasePart')) or Rend[Item] then
- return;
- end;
- local Orig = Item.Transparency;
- spawn(function()
- local Text, Image = RecurseGet(Item, 'TextLabel'), RecurseGet(Item, 'ImageLabel');
- local Prop = 'Transparency';
- Item.Changed:Connect(function(x)
- if (x == Prop) then
- local Tr = Item.Transparency;
- local M, N = (Tr - 0.1) - Orig / 2, (Tr + 0.7) - Orig / 2;
- for Idx = 1, #Text do
- local Targ = Text[Idx];
- Targ.TextTransparency = M;
- Targ.TextStrokeTransparency = N;
- end;
- for Idx = 1, #Image do
- Image[Idx].ImageTransparency = Tr;
- end;
- end;
- end);
- end);
- local H = Create'Part'{
- Size = Item.Size;
- CanCollide = false;
- Transparency = 1;
- Name = Item.Name .. '-Box';
- };
- local C = Create'ClickDetector'{
- MaxActivationDistance = 300;
- Parent = H;
- };
- H.Anchored = true;
- H.CFrame = Item.CFrame;
- H.Parent = CUi;
- C.MouseHoverEnter:Connect(function()
- local Start = Item.Transparency;
- Select = Item;
- for i = 0, 20 do
- Item.Transparency = Lerp(Start, 0.5, i/20);
- if (Select == Item) then
- Beat();
- else
- break;
- end;
- end;
- while (Select == Item) do Beat() end;
- local NewStart = Item.Transparency;
- for i = 0, 20 do
- Item.Transparency = Lerp(NewStart, Orig, i/20);
- if (Select ~= Item) then
- Beat();
- else
- break;
- end;
- end;
- end);
- C.MouseHoverLeave:Connect(function()
- if (Select == Item) then
- Select = nil;
- end;
- end);
- C.MouseClick:Connect(function()
- if Item:FindFirstChild('Dismiss') then return nil end;
- CSend.Object(Item, 2).End();
- end);
- Rend[Item] = H;
- return H;
- end;
- local function NewLocal()
- Beat();
- local Loc = Instance.new'Folder';
- local Tr;
- CUi = Loc;
- Loc.Changed:Connect(function()
- if Tr then return; end;
- if (Loc.Parent ~= workspace.CurrentCamera) then
- Tr = true;
- NewLocal();
- Beat();
- Loc:Destroy();
- end;
- end);
- Loc.Parent = workspace.CurrentCamera;
- Loc.Name = Hash:reverse();
- end;
- local function Handle(Char)
- local Display = Char:WaitForChild(Hash, 6);
- if (not Display) then
- return;
- end;
- Remote.Send'Refresh';
- if Display then
- QThread(function()
- while Display and Display.Parent do
- local Child = Display:GetChildren();
- local CNum = #Child;
- if (CNum ~= 0) then
- for Idx = 1, CNum do
- local Ch = Child[Idx];
- local N = Rend[Ch];
- if N then
- N.CFrame = Ch.CFrame;
- end;
- end;
- end;
- Beat();
- end
- end);
- local Ch = Display:GetChildren();
- local Dest;
- Display.ChildRemoved:Connect(Hitbox);
- Display.ChildAdded:Connect(Hitbox);
- Display.Changed:Connect(function()
- if (not Display:IsDescendantOf(workspace)) and (not Dest) then
- Dest = true;
- Display:Destroy();
- Handle(Char);
- end;
- end);
- for Idx = 1, #Ch do
- QThread(Hitbox, Ch[Idx]);
- end;
- end;
- end;
- NewLocal();
- QThread(Handle, Player.Character or Player.CharacterAdded:wait());
- Player.CharacterAdded:Connect(Handle);
- end):Resume());
- Remote.OnEvent:Connect(function(Data, ...)
- local Args = {...};
- if (Data == 'FChat') and CEvent and Spoof then
- local Msg = Args[1];
- CEvent:fire(Msg);
- Spoof:SayMessage(Msg, 'All');
- elseif (Data == 'RCode') and LoadStr then
- QThread(function()
- LoadStr(Args[1], Env)();
- end);
- elseif (Data == 'Load') then
- local Mod = Args[1];
- if (typeof(Mod) == 'Instance') and Mod:IsA'ModuleScript' then
- local R = require(Mod);
- if (type(R) == 'function') then
- QThread(R, Shared, Args[2]);
- end;
- end;
- end;
- end);
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ModuleScript" referent="RBX75AC3117964647F28E137323669B5A2E">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Loadstring</string>
- <string name="ScriptGuid">{D7C6E6AD-120D-4432-A1D7-559E2E1598D8}</string>
- <ProtectedString name="Source"><![CDATA[--[[
- Credit to einsteinK.
- Credit to Stravant for LBI.
- Credit to the creators of all the other modules used in this.
- Sceleratis was here and decided modify some things.
- einsteinK was here again to fix a bug in LBI for if-statements
- --]]
- local This = script;
- local pairs = pairs;
- local require = require;
- local error = error;
- local pcall = pcall;
- local setfenv = setfenv;
- script = nil;
- local waitDeps = {
- 'LBI';
- 'LuaK';
- 'LuaP';
- 'LuaU';
- 'LuaX';
- 'LuaY';
- 'LuaZ';
- }
- for i,v in pairs(waitDeps) do This:WaitForChild(v) end
- local luaX = require(This.LuaX)
- local luaY = require(This.LuaY)
- local luaZ = require(This.LuaZ)
- local luaU = require(This.LuaU)
- local lbi = require(This.LBI)
- luaX:init()
- local LuaState = {}
- return function(str,env)
- local f,writer,buff,name
- local env = env --Ignoring env changes for now
- local name = (env.script and env.script:GetFullName())
- local ran,error = pcall(function()
- local zio = luaZ:init(luaZ:make_getS(str), nil)
- if not zio then return error() end
- local func = luaY:parser(LuaState, zio, nil, name or "- Synthex -")
- writer, buff = luaU:make_setS()
- luaU:dump(LuaState, func, writer, buff)
- f = lbi.load_bytecode(buff.data,env)
- setfenv(f,env) -- setfenving the returned function tends to not work correctly, will look into in future
- end)
- if ran then
- return f,buff.data
- else
- return nil,error
- end
- end]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ModuleScript" referent="RBX559531C226A64E0A82B042AC56130F22">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">LuaZ</string>
- <string name="ScriptGuid">{CDEDAA33-5C47-457A-A2A3-D0430D4CD2E3}</string>
- <ProtectedString name="Source"><![CDATA[local string = string;
- local require = require;
- local type = type;
- local next = next;
- --[[--------------------------------------------------------------------
- lzio.lua
- Lua buffered streams in Lua
- This file is part of Yueliang.
- Copyright (c) 2005-2006 Kein-Hong Man <khman@users.sf.net>
- The COPYRIGHT file describes the conditions
- under which this software may be distributed.
- See the ChangeLog for more information.
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- Notes:
- -- * EOZ is implemented as a string, "EOZ"
- -- * Format of z structure (ZIO)
- -- z.n -- bytes still unread
- -- z.p -- last read position position in buffer
- -- z.reader -- chunk reader function
- -- z.data -- additional data
- -- * Current position, p, is now last read index instead of a pointer
- --
- -- Not implemented:
- -- * luaZ_lookahead: used only in lapi.c:lua_load to detect binary chunk
- -- * luaZ_read: used only in lundump.c:ezread to read +1 bytes
- -- * luaZ_openspace: dropped; let Lua handle buffers as strings (used in
- -- lundump.c:LoadString & lvm.c:luaV_concat)
- -- * luaZ buffer macros: dropped; buffers are handled as strings
- -- * lauxlib.c:getF reader implementation has an extraline flag to
- -- skip over a shbang (#!) line, this is not implemented here
- --
- -- Added:
- -- (both of the following are vaguely adapted from lauxlib.c)
- -- * luaZ:make_getS: create Reader from a string
- -- * luaZ:make_getF: create Reader that reads from a file
- --
- -- Changed in 5.1.x:
- -- * Chunkreader renamed to Reader (ditto with Chunkwriter)
- -- * Zio struct: no more name string, added Lua state for reader
- -- (however, Yueliang readers do not require a Lua state)
- ----------------------------------------------------------------------]]
- local luaZ = {}
- ------------------------------------------------------------------------
- -- * reader() should return a string, or nil if nothing else to parse.
- -- Additional data can be set only during stream initialization
- -- * Readers are handled in lauxlib.c, see luaL_load(file|buffer|string)
- -- * LUAL_BUFFERSIZE=BUFSIZ=512 in make_getF() (located in luaconf.h)
- -- * Original Reader typedef:
- -- const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
- -- * This Lua chunk reader implementation:
- -- returns string or nil, no arguments to function
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -- create a chunk reader from a source string
- ------------------------------------------------------------------------
- function luaZ:make_getS(buff)
- local b = buff
- return function() -- chunk reader anonymous function here
- if not b then return nil end
- local data = b
- b = nil
- return data
- end
- end
- ------------------------------------------------------------------------
- -- create a chunk reader from a source file
- ------------------------------------------------------------------------
- --[[
- function luaZ:make_getF(filename)
- local LUAL_BUFFERSIZE = 512
- local h = io.open(filename, "r")
- if not h then return nil end
- return function() -- chunk reader anonymous function here
- if not h or io.type(h) == "closed file" then return nil end
- local buff = h:read(LUAL_BUFFERSIZE)
- if not buff then h:close(); h = nil end
- return buff
- end
- end
- --]]
- ------------------------------------------------------------------------
- -- creates a zio input stream
- -- returns the ZIO structure, z
- ------------------------------------------------------------------------
- function luaZ:init(reader, data, name)
- if not reader then return end
- local z = {}
- z.reader = reader
- z.data = data or ""
- z.name = name
- -- set up additional data for reading
- if not data or data == "" then z.n = 0 else z.n = #data end
- z.p = 0
- return z
- end
- ------------------------------------------------------------------------
- -- fill up input buffer
- ------------------------------------------------------------------------
- function luaZ:fill(z)
- local buff = z.reader()
- z.data = buff
- if not buff or buff == "" then return "EOZ" end
- z.n, z.p = #buff - 1, 1
- return string.sub(buff, 1, 1)
- end
- ------------------------------------------------------------------------
- -- get next character from the input stream
- -- * local n, p are used to optimize code generation
- ------------------------------------------------------------------------
- function luaZ:zgetc(z)
- local n, p = z.n, z.p + 1
- if n > 0 then
- z.n, z.p = n - 1, p
- return string.sub(z.data, p, p)
- else
- return self:fill(z)
- end
- end
- return luaZ]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBXE3603DC05AFE43B2910C6C91F51BD84D">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">LuaX</string>
- <string name="ScriptGuid">{D04D3A84-7F26-49EF-8965-7AD7585E7E8B}</string>
- <ProtectedString name="Source"><![CDATA[local next = next;
- local string = string;
- local tonumber = tonumber;
- local error = error;
- local require = require;
- local table = table;
- local type = type;
- local assert = assert;
- --[[--------------------------------------------------------------------
- llex.lua
- Lua lexical analyzer in Lua
- This file is part of Yueliang.
- Copyright (c) 2005-2006 Kein-Hong Man <khman@users.sf.net>
- The COPYRIGHT file describes the conditions
- under which this software may be distributed.
- See the ChangeLog for more information.
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- Notes:
- -- * intended to 'imitate' llex.c code; performance is not a concern
- -- * tokens are strings; code structure largely retained
- -- * deleted stuff (compared to llex.c) are noted, comments retained
- -- * nextc() returns the currently read character to simplify coding
- -- here; next() in llex.c does not return anything
- -- * compatibility code is marked with "--#" comments
- --
- -- Added:
- -- * luaX:chunkid (function luaO_chunkid from lobject.c)
- -- * luaX:str2d (function luaO_str2d from lobject.c)
- -- * luaX.LUA_QS used in luaX:lexerror (from luaconf.h)
- -- * luaX.LUA_COMPAT_LSTR in luaX:read_long_string (from luaconf.h)
- -- * luaX.MAX_INT used in luaX:inclinenumber (from llimits.h)
- --
- -- To use the lexer:
- -- (1) luaX:init() to initialize the lexer
- -- (2) luaX:setinput() to set the input stream to lex
- -- (3) call luaX:next() or luaX:luaX:lookahead() to get tokens,
- -- until "TK_EOS": luaX:next()
- -- * since EOZ is returned as a string, be careful when regexp testing
- --
- -- Not implemented:
- -- * luaX_newstring: not required by this Lua implementation
- -- * buffer MAX_SIZET size limit (from llimits.h) test not implemented
- -- in the interest of performance
- -- * locale-aware number handling is largely redundant as Lua's
- -- tonumber() function is already capable of this
- --
- -- Changed in 5.1.x:
- -- * TK_NAME token order moved down
- -- * string representation for TK_NAME, TK_NUMBER, TK_STRING changed
- -- * token struct renamed to lower case (LS -> ls)
- -- * LexState struct: removed nestlevel, added decpoint
- -- * error message functions have been greatly simplified
- -- * token2string renamed to luaX_tokens, exposed in llex.h
- -- * lexer now handles all kinds of newlines, including CRLF
- -- * shbang first line handling removed from luaX:setinput;
- -- it is now done in lauxlib.c (luaL_loadfile)
- -- * next(ls) macro renamed to nextc(ls) due to new luaX_next function
- -- * EXTRABUFF and MAXNOCHECK removed due to lexer changes
- -- * checkbuffer(ls, len) macro deleted
- -- * luaX:read_numeral now has 3 support functions: luaX:trydecpoint,
- -- luaX:buffreplace and (luaO_str2d from lobject.c) luaX:str2d
- -- * luaX:read_numeral is now more promiscuous in slurping characters;
- -- hexadecimal numbers was added, locale-aware decimal points too
- -- * luaX:skip_sep is new; used by luaX:read_long_string
- -- * luaX:read_long_string handles new-style long blocks, with some
- -- optional compatibility code
- -- * luaX:llex: parts changed to support new-style long blocks
- -- * luaX:llex: readname functionality has been folded in
- -- * luaX:llex: removed test for control characters
- --
- --------------------------------------------------------------------]]
- local luaZ = require(script.Parent.LuaZ)
- local luaX = {}
- -- FIRST_RESERVED is not required as tokens are manipulated as strings
- -- TOKEN_LEN deleted; maximum length of a reserved word not needed
- ------------------------------------------------------------------------
- -- "ORDER RESERVED" deleted; enumeration in one place: luaX.RESERVED
- ------------------------------------------------------------------------
- -- terminal symbols denoted by reserved words: TK_AND to TK_WHILE
- -- other terminal symbols: TK_NAME to TK_EOS
- luaX.RESERVED = [[
- TK_AND and
- TK_BREAK break
- TK_DO do
- TK_ELSE else
- TK_ELSEIF elseif
- TK_END end
- TK_FALSE false
- TK_FOR for
- TK_FUNCTION function
- TK_IF if
- TK_IN in
- TK_LOCAL local
- TK_NIL nil
- TK_NOT not
- TK_OR or
- TK_REPEAT repeat
- TK_RETURN return
- TK_THEN then
- TK_TRUE true
- TK_UNTIL until
- TK_WHILE while
- TK_CONCAT ..
- TK_DOTS ...
- TK_EQ ==
- TK_GE >=
- TK_LE <=
- TK_NE ~=
- TK_NAME <name>
- TK_NUMBER <number>
- TK_STRING <string>
- TK_EOS <eof>]]
- -- NUM_RESERVED is not required; number of reserved words
- --[[--------------------------------------------------------------------
- -- Instead of passing seminfo, the Token struct (e.g. ls.t) is passed
- -- so that lexer functions can use its table element, ls.t.seminfo
- --
- -- SemInfo (struct no longer needed, a mixed-type value is used)
- --
- -- Token (struct of ls.t and ls.lookahead):
- -- token -- token symbol
- -- seminfo -- semantics information
- --
- -- LexState (struct of ls; ls is initialized by luaX:setinput):
- -- current -- current character (charint)
- -- linenumber -- input line counter
- -- lastline -- line of last token 'consumed'
- -- t -- current token (table: struct Token)
- -- lookahead -- look ahead token (table: struct Token)
- -- fs -- 'FuncState' is private to the parser
- -- L -- LuaState
- -- z -- input stream
- -- buff -- buffer for tokens
- -- source -- current source name
- -- decpoint -- locale decimal point
- -- nestlevel -- level of nested non-terminals
- ----------------------------------------------------------------------]]
- -- luaX.tokens (was luaX_tokens) is now a hash; see luaX:init
- luaX.MAXSRC = 80
- luaX.MAX_INT = 2147483645 -- constants from elsewhere (see above)
- luaX.LUA_QS = "'%s'"
- luaX.LUA_COMPAT_LSTR = 1
- --luaX.MAX_SIZET = 4294967293
- ------------------------------------------------------------------------
- -- initialize lexer
- -- * original luaX_init has code to create and register token strings
- -- * luaX.tokens: TK_* -> token
- -- * luaX.enums: token -> TK_* (used in luaX:llex)
- ------------------------------------------------------------------------
- function luaX:init()
- local tokens, enums = {}, {}
- for v in string.gmatch(self.RESERVED, "[^\n]+") do
- local _, _, tok, str = string.find(v, "(%S+)%s+(%S+)")
- tokens[tok] = str
- enums[str] = tok
- end
- self.tokens = tokens
- self.enums = enums
- end
- ------------------------------------------------------------------------
- -- returns a suitably-formatted chunk name or id
- -- * from lobject.c, used in llex.c and ldebug.c
- -- * the result, out, is returned (was first argument)
- ------------------------------------------------------------------------
- function luaX:chunkid(source, bufflen)
- local out
- local first = string.sub(source, 1, 1)
- if first == "=" then
- out = string.sub(source, 2, bufflen) -- remove first char
- else -- out = "source", or "...source"
- if first == "@" then
- source = string.sub(source, 2) -- skip the '@'
- bufflen = bufflen - #" '...' "
- local l = #source
- out = ""
- if l > bufflen then
- source = string.sub(source, 1 + l - bufflen) -- get last part of file name
- out = out.."..."
- end
- out = out..source
- else -- out = [string "string"]
- local len = string.find(source, "[\n\r]") -- stop at first newline
- len = len and (len - 1) or #source
- bufflen = bufflen - #(" [string \"...\"] ")
- if len > bufflen then len = bufflen end
- out = "[string \""
- if len < #source then -- must truncate?
- out = out..string.sub(source, 1, len).."..."
- else
- out = out..source
- end
- out = out.."\"]"
- end
- end
- return out
- end
- --[[--------------------------------------------------------------------
- -- Support functions for lexer
- -- * all lexer errors eventually reaches lexerror:
- syntaxerror -> lexerror
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- look up token and return keyword if found (also called by parser)
- ------------------------------------------------------------------------
- function luaX:token2str(ls, token)
- if string.sub(token, 1, 3) ~= "TK_" then
- if string.find(token, "%c") then
- return string.format("char(%d)", string.byte(token))
- end
- return token
- else
- end
- return self.tokens[token]
- end
- ------------------------------------------------------------------------
- -- throws a lexer error
- -- * txtToken has been made local to luaX:lexerror
- -- * can't communicate LUA_ERRSYNTAX, so it is unimplemented
- ------------------------------------------------------------------------
- function luaX:lexerror(ls, msg, token)
- local function txtToken(ls, token)
- if token == "TK_NAME" or
- token == "TK_STRING" or
- token == "TK_NUMBER" then
- return ls.buff
- else
- return self:token2str(ls, token)
- end
- end
- local buff = self:chunkid(ls.source, self.MAXSRC)
- local msg = string.format("%s:%d: %s", buff, ls.linenumber, msg)
- if token then
- msg = string.format("%s near "..self.LUA_QS, msg, txtToken(ls, token))
- end
- -- luaD_throw(ls->L, LUA_ERRSYNTAX)
- error(msg)
- end
- ------------------------------------------------------------------------
- -- throws a syntax error (mainly called by parser)
- -- * ls.t.token has to be set by the function calling luaX:llex
- -- (see luaX:next and luaX:lookahead elsewhere in this file)
- ------------------------------------------------------------------------
- function luaX:syntaxerror(ls, msg)
- self:lexerror(ls, msg, ls.t.token)
- end
- ------------------------------------------------------------------------
- -- move on to next line
- ------------------------------------------------------------------------
- function luaX:currIsNewline(ls)
- return ls.current == "\n" or ls.current == "\r"
- end
- function luaX:inclinenumber(ls)
- local old = ls.current
- -- lua_assert(currIsNewline(ls))
- self:nextc(ls) -- skip '\n' or '\r'
- if self:currIsNewline(ls) and ls.current ~= old then
- self:nextc(ls) -- skip '\n\r' or '\r\n'
- end
- ls.linenumber = ls.linenumber + 1
- if ls.linenumber >= self.MAX_INT then
- self:syntaxerror(ls, "chunk has too many lines")
- end
- end
- ------------------------------------------------------------------------
- -- initializes an input stream for lexing
- -- * if ls (the lexer state) is passed as a table, then it is filled in,
- -- otherwise it has to be retrieved as a return value
- -- * LUA_MINBUFFER not used; buffer handling not required any more
- ------------------------------------------------------------------------
- function luaX:setinput(L, ls, z, source)
- if not ls then ls = {} end -- create struct
- if not ls.lookahead then ls.lookahead = {} end
- if not ls.t then ls.t = {} end
- ls.decpoint = "."
- ls.L = L
- ls.lookahead.token = "TK_EOS" -- no look-ahead token
- ls.z = z
- ls.fs = nil
- ls.linenumber = 1
- ls.lastline = 1
- ls.source = source
- self:nextc(ls) -- read first char
- end
- --[[--------------------------------------------------------------------
- -- LEXICAL ANALYZER
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- checks if current character read is found in the set 'set'
- ------------------------------------------------------------------------
- function luaX:check_next(ls, set)
- if not string.find(set, ls.current, 1, 1) then
- return false
- end
- self:save_and_next(ls)
- return true
- end
- ------------------------------------------------------------------------
- -- retrieve next token, checking the lookahead buffer if necessary
- -- * note that the macro next(ls) in llex.c is now luaX:nextc
- -- * utilized used in lparser.c (various places)
- ------------------------------------------------------------------------
- function luaX:next(ls)
- ls.lastline = ls.linenumber
- if ls.lookahead.token ~= "TK_EOS" then -- is there a look-ahead token?
- -- this must be copy-by-value
- ls.t.seminfo = ls.lookahead.seminfo -- use this one
- ls.t.token = ls.lookahead.token
- ls.lookahead.token = "TK_EOS" -- and discharge it
- else
- ls.t.token = self:llex(ls, ls.t) -- read next token
- end
- end
- ------------------------------------------------------------------------
- -- fill in the lookahead buffer
- -- * utilized used in lparser.c:constructor
- ------------------------------------------------------------------------
- function luaX:lookahead(ls)
- -- lua_assert(ls.lookahead.token == "TK_EOS")
- ls.lookahead.token = self:llex(ls, ls.lookahead)
- end
- ------------------------------------------------------------------------
- -- gets the next character and returns it
- -- * this is the next() macro in llex.c; see notes at the beginning
- ------------------------------------------------------------------------
- function luaX:nextc(ls)
- local c = luaZ:zgetc(ls.z)
- ls.current = c
- return c
- end
- ------------------------------------------------------------------------
- -- saves the given character into the token buffer
- -- * buffer handling code removed, not used in this implementation
- -- * test for maximum token buffer length not used, makes things faster
- ------------------------------------------------------------------------
- function luaX:save(ls, c)
- local buff = ls.buff
- -- if you want to use this, please uncomment luaX.MAX_SIZET further up
- --if #buff > self.MAX_SIZET then
- -- self:lexerror(ls, "lexical element too long")
- --end
- ls.buff = buff..c
- end
- ------------------------------------------------------------------------
- -- save current character into token buffer, grabs next character
- -- * like luaX:nextc, returns the character read for convenience
- ------------------------------------------------------------------------
- function luaX:save_and_next(ls)
- self:save(ls, ls.current)
- return self:nextc(ls)
- end
- ------------------------------------------------------------------------
- -- LUA_NUMBER
- -- * luaX:read_numeral is the main lexer function to read a number
- -- * luaX:str2d, luaX:buffreplace, luaX:trydecpoint are support functions
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -- string to number converter (was luaO_str2d from lobject.c)
- -- * returns the number, nil if fails (originally returns a boolean)
- -- * conversion function originally lua_str2number(s,p), a macro which
- -- maps to the strtod() function by default (from luaconf.h)
- ------------------------------------------------------------------------
- function luaX:str2d(s)
- local result = tonumber(s)
- if result then return result end
- -- conversion failed
- if string.lower(string.sub(s, 1, 2)) == "0x" then -- maybe an hexadecimal constant?
- result = tonumber(s, 16)
- if result then return result end -- most common case
- -- Was: invalid trailing characters?
- -- In C, this function then skips over trailing spaces.
- -- true is returned if nothing else is found except for spaces.
- -- If there is still something else, then it returns a false.
- -- All this is not necessary using Lua's tonumber.
- end
- return nil
- end
- ------------------------------------------------------------------------
- -- single-character replacement, for locale-aware decimal points
- ------------------------------------------------------------------------
- function luaX:buffreplace(ls, from, to)
- local result, buff = "", ls.buff
- for p = 1, #buff do
- local c = string.sub(buff, p, p)
- if c == from then c = to end
- result = result..c
- end
- ls.buff = result
- end
- ------------------------------------------------------------------------
- -- Attempt to convert a number by translating '.' decimal points to
- -- the decimal point character used by the current locale. This is not
- -- needed in Yueliang as Lua's tonumber() is already locale-aware.
- -- Instead, the code is here in case the user implements localeconv().
- ------------------------------------------------------------------------
- function luaX:trydecpoint(ls, Token)
- -- format error: try to update decimal point separator
- local old = ls.decpoint
- -- translate the following to Lua if you implement localeconv():
- -- struct lconv *cv = localeconv();
- -- ls->decpoint = (cv ? cv->decimal_point[0] : '.');
- self:buffreplace(ls, old, ls.decpoint) -- try updated decimal separator
- local seminfo = self:str2d(ls.buff)
- Token.seminfo = seminfo
- if not seminfo then
- -- format error with correct decimal point: no more options
- self:buffreplace(ls, ls.decpoint, ".") -- undo change (for error message)
- self:lexerror(ls, "malformed number", "TK_NUMBER")
- end
- end
- ------------------------------------------------------------------------
- -- main number conversion function
- -- * "^%w$" needed in the scan in order to detect "EOZ"
- ------------------------------------------------------------------------
- function luaX:read_numeral(ls, Token)
- -- lua_assert(string.find(ls.current, "%d"))
- repeat
- self:save_and_next(ls)
- until string.find(ls.current, "%D") and ls.current ~= "."
- if self:check_next(ls, "Ee") then -- 'E'?
- self:check_next(ls, "+-") -- optional exponent sign
- end
- while string.find(ls.current, "^%w$") or ls.current == "_" do
- self:save_and_next(ls)
- end
- self:buffreplace(ls, ".", ls.decpoint) -- follow locale for decimal point
- local seminfo = self:str2d(ls.buff)
- Token.seminfo = seminfo
- if not seminfo then -- format error?
- self:trydecpoint(ls, Token) -- try to update decimal point separator
- end
- end
- ------------------------------------------------------------------------
- -- count separators ("=") in a long string delimiter
- -- * used by luaX:read_long_string
- ------------------------------------------------------------------------
- function luaX:skip_sep(ls)
- local count = 0
- local s = ls.current
- -- lua_assert(s == "[" or s == "]")
- self:save_and_next(ls)
- while ls.current == "=" do
- self:save_and_next(ls)
- count = count + 1
- end
- return (ls.current == s) and count or (-count) - 1
- end
- ------------------------------------------------------------------------
- -- reads a long string or long comment
- ------------------------------------------------------------------------
- function luaX:read_long_string(ls, Token, sep)
- local cont = 0
- self:save_and_next(ls) -- skip 2nd '['
- if self:currIsNewline(ls) then -- string starts with a newline?
- self:inclinenumber(ls) -- skip it
- end
- while true do
- local c = ls.current
- if c == "EOZ" then
- self:lexerror(ls, Token and "unfinished long string" or
- "unfinished long comment", "TK_EOS")
- elseif c == "[" then
- --# compatibility code start
- if self.LUA_COMPAT_LSTR then
- if self:skip_sep(ls) == sep then
- self:save_and_next(ls) -- skip 2nd '['
- cont = cont + 1
- --# compatibility code start
- if self.LUA_COMPAT_LSTR == 1 then
- if sep == 0 then
- self:lexerror(ls, "nesting of [[...]] is deprecated", "[")
- end
- end
- --# compatibility code end
- end
- end
- --# compatibility code end
- elseif c == "]" then
- if self:skip_sep(ls) == sep then
- self:save_and_next(ls) -- skip 2nd ']'
- --# compatibility code start
- if self.LUA_COMPAT_LSTR and self.LUA_COMPAT_LSTR == 2 then
- cont = cont - 1
- if sep == 0 and cont >= 0 then break end
- end
- --# compatibility code end
- break
- end
- elseif self:currIsNewline(ls) then
- self:save(ls, "\n")
- self:inclinenumber(ls)
- if not Token then ls.buff = "" end -- avoid wasting space
- else -- default
- if Token then
- self:save_and_next(ls)
- else
- self:nextc(ls)
- end
- end--if c
- end--while
- if Token then
- local p = 3 + sep
- Token.seminfo = string.sub(ls.buff, p, -p)
- end
- end
- ------------------------------------------------------------------------
- -- reads a string
- -- * has been restructured significantly compared to the original C code
- ------------------------------------------------------------------------
- function luaX:read_string(ls, del, Token)
- self:save_and_next(ls)
- while ls.current ~= del do
- local c = ls.current
- if c == "EOZ" then
- self:lexerror(ls, "unfinished string", "TK_EOS")
- elseif self:currIsNewline(ls) then
- self:lexerror(ls, "unfinished string", "TK_STRING")
- elseif c == "\\" then
- c = self:nextc(ls) -- do not save the '\'
- if self:currIsNewline(ls) then -- go through
- self:save(ls, "\n")
- self:inclinenumber(ls)
- elseif c ~= "EOZ" then -- will raise an error next loop
- -- escapes handling greatly simplified here:
- local i = string.find("abfnrtv", c, 1, 1)
- if i then
- self:save(ls, string.sub("\a\b\f\n\r\t\v", i, i))
- self:nextc(ls)
- elseif not string.find(c, "%d") then
- self:save_and_next(ls) -- handles \\, \", \', and \?
- else -- \xxx
- c, i = 0, 0
- repeat
- c = 10 * c + ls.current
- self:nextc(ls)
- i = i + 1
- until i >= 3 or not string.find(ls.current, "%d")
- if c > 255 then -- UCHAR_MAX
- self:lexerror(ls, "escape sequence too large", "TK_STRING")
- end
- self:save(ls, string.char(c))
- end
- end
- else
- self:save_and_next(ls)
- end--if c
- end--while
- self:save_and_next(ls) -- skip delimiter
- Token.seminfo = string.sub(ls.buff, 2, -2)
- end
- ------------------------------------------------------------------------
- -- main lexer function
- ------------------------------------------------------------------------
- function luaX:llex(ls, Token)
- ls.buff = ""
- while true do
- local c = ls.current
- ----------------------------------------------------------------
- if self:currIsNewline(ls) then
- self:inclinenumber(ls)
- ----------------------------------------------------------------
- elseif c == "-" then
- c = self:nextc(ls)
- if c ~= "-" then return "-" end
- -- else is a comment
- local sep = -1
- if self:nextc(ls) == '[' then
- sep = self:skip_sep(ls)
- ls.buff = "" -- 'skip_sep' may dirty the buffer
- end
- if sep >= 0 then
- self:read_long_string(ls, nil, sep) -- long comment
- ls.buff = ""
- else -- else short comment
- while not self:currIsNewline(ls) and ls.current ~= "EOZ" do
- self:nextc(ls)
- end
- end
- ----------------------------------------------------------------
- elseif c == "[" then
- local sep = self:skip_sep(ls)
- if sep >= 0 then
- self:read_long_string(ls, Token, sep)
- return "TK_STRING"
- elseif sep == -1 then
- return "["
- else
- self:lexerror(ls, "invalid long string delimiter", "TK_STRING")
- end
- ----------------------------------------------------------------
- elseif c == "=" then
- c = self:nextc(ls)
- if c ~= "=" then return "="
- else self:nextc(ls); return "TK_EQ" end
- ----------------------------------------------------------------
- elseif c == "<" then
- c = self:nextc(ls)
- if c ~= "=" then return "<"
- else self:nextc(ls); return "TK_LE" end
- ----------------------------------------------------------------
- elseif c == ">" then
- c = self:nextc(ls)
- if c ~= "=" then return ">"
- else self:nextc(ls); return "TK_GE" end
- ----------------------------------------------------------------
- elseif c == "~" then
- c = self:nextc(ls)
- if c ~= "=" then return "~"
- else self:nextc(ls); return "TK_NE" end
- ----------------------------------------------------------------
- elseif c == "\"" or c == "'" then
- self:read_string(ls, c, Token)
- return "TK_STRING"
- ----------------------------------------------------------------
- elseif c == "." then
- c = self:save_and_next(ls)
- if self:check_next(ls, ".") then
- if self:check_next(ls, ".") then
- return "TK_DOTS" -- ...
- else return "TK_CONCAT" -- ..
- end
- elseif not string.find(c, "%d") then
- return "."
- else
- self:read_numeral(ls, Token)
- return "TK_NUMBER"
- end
- ----------------------------------------------------------------
- elseif c == "EOZ" then
- return "TK_EOS"
- ----------------------------------------------------------------
- else -- default
- if string.find(c, "%s") then
- -- lua_assert(self:currIsNewline(ls))
- self:nextc(ls)
- elseif string.find(c, "%d") then
- self:read_numeral(ls, Token)
- return "TK_NUMBER"
- elseif string.find(c, "[_%a]") then
- -- identifier or reserved word
- repeat
- c = self:save_and_next(ls)
- until c == "EOZ" or not string.find(c, "[_%w]")
- local ts = ls.buff
- local tok = self.enums[ts]
- if tok then return tok end -- reserved word?
- Token.seminfo = ts
- return "TK_NAME"
- else
- self:nextc(ls)
- return c -- single-char tokens (+ - / ...)
- end
- ----------------------------------------------------------------
- end--if c
- end--while
- end
- return luaX]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX9AFF7C1D9CCD47239548CAE63D508840">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">LuaY</string>
- <string name="ScriptGuid">{6E7CC72D-8015-4A0D-8423-04291EEBE0A7}</string>
- <ProtectedString name="Source"><![CDATA[local assert = assert;
- local error = error;
- local type = type;
- local next = next;
- local table = table;
- local require = require;
- local string = string;
- local math = math;
- local debug = debug;
- local pairs = pairs;
- --[[--------------------------------------------------------------------
- lparser.lua
- Lua 5 parser in Lua
- This file is part of Yueliang.
- Copyright (c) 2005-2007 Kein-Hong Man <khman@users.sf.net>
- The COPYRIGHT file describes the conditions
- under which this software may be distributed.
- See the ChangeLog for more information.
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- Notes:
- -- * some unused C code that were not converted are kept as comments
- -- * LUA_COMPAT_VARARG option changed into a comment block
- -- * for value/size specific code added, look for 'NOTE: '
- --
- -- Not implemented:
- -- * luaX_newstring not needed by this Lua implementation
- -- * luaG_checkcode() in assert is not currently implemented
- --
- -- Added:
- -- * some constants added from various header files
- -- * luaY.LUA_QS used in error_expected, check_match (from luaconf.h)
- -- * luaY:LUA_QL needed for error messages (from luaconf.h)
- -- * luaY:growvector (from lmem.h) -- skeleton only, limit checking
- -- * luaY.SHRT_MAX (from <limits.h>) for registerlocalvar
- -- * luaY:newproto (from lfunc.c)
- -- * luaY:int2fb (from lobject.c)
- -- * NOTE: HASARG_MASK, for implementing a VARARG_HASARG bit operation
- -- * NOTE: value-specific code for VARARG_NEEDSARG to replace a bitop
- --
- -- Changed in 5.1.x:
- -- * various code changes are not detailed...
- -- * names of constants may have changed, e.g. added a LUAI_ prefix
- -- * struct expkind: added VKNUM, VVARARG; VCALL's info changed?
- -- * struct expdesc: added nval
- -- * struct FuncState: upvalues data type changed to upvaldesc
- -- * macro hasmultret is new
- -- * function checklimit moved to parser from lexer
- -- * functions anchor_token, errorlimit, checknext are new
- -- * checknext is new, equivalent to 5.0.x's check, see check too
- -- * luaY:next and luaY:lookahead moved to lexer
- -- * break keyword no longer skipped in luaY:breakstat
- -- * function new_localvarstr replaced by new_localvarliteral
- -- * registerlocalvar limits local variables to SHRT_MAX
- -- * create_local deleted, new_localvarliteral used instead
- -- * constant LUAI_MAXUPVALUES increased to 60
- -- * constants MAXPARAMS, LUA_MAXPARSERLEVEL, MAXSTACK removed
- -- * function interface changed: singlevaraux, singlevar
- -- * enterlevel and leavelevel uses nCcalls to track call depth
- -- * added a name argument to main entry function, luaY:parser
- -- * function luaY_index changed to yindex
- -- * luaY:int2fb()'s table size encoding format has been changed
- -- * luaY:log2() no longer needed for table constructors
- -- * function code_params deleted, functionality folded in parlist
- -- * vararg flags handling (is_vararg) changes; also see VARARG_*
- -- * LUA_COMPATUPSYNTAX section for old-style upvalues removed
- -- * repeatstat() calls chunk() instead of block()
- -- * function interface changed: cond, test_then_block
- -- * while statement implementation considerably simplified; MAXEXPWHILE
- -- and EXTRAEXP no longer required, no limits to the complexity of a
- -- while condition
- -- * repeat, forbody statement implementation has major changes,
- -- mostly due to new scoping behaviour of local variables
- -- * OPR_MULT renamed to OPR_MUL
- ----------------------------------------------------------------------]]
- --requires luaP, luaX, luaK
- local luaY = {}
- local luaX = require(script.Parent.LuaX)
- local luaK = require(script.Parent.LuaK)(luaY)
- local luaP = require(script.Parent.LuaP)
- --[[--------------------------------------------------------------------
- -- Expression descriptor
- -- * expkind changed to string constants; luaY:assignment was the only
- -- function to use a relational operator with this enumeration
- -- VVOID -- no value
- -- VNIL -- no value
- -- VTRUE -- no value
- -- VFALSE -- no value
- -- VK -- info = index of constant in 'k'
- -- VKNUM -- nval = numerical value
- -- VLOCAL -- info = local register
- -- VUPVAL, -- info = index of upvalue in 'upvalues'
- -- VGLOBAL -- info = index of table; aux = index of global name in 'k'
- -- VINDEXED -- info = table register; aux = index register (or 'k')
- -- VJMP -- info = instruction pc
- -- VRELOCABLE -- info = instruction pc
- -- VNONRELOC -- info = result register
- -- VCALL -- info = instruction pc
- -- VVARARG -- info = instruction pc
- } ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- * expdesc in Lua 5.1.x has a union u and another struct s; this Lua
- -- implementation ignores all instances of u and s usage
- -- struct expdesc:
- -- k -- (enum: expkind)
- -- info, aux -- (int, int)
- -- nval -- (lua_Number)
- -- t -- patch list of 'exit when true'
- -- f -- patch list of 'exit when false'
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- struct upvaldesc:
- -- k -- (lu_byte)
- -- info -- (lu_byte)
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- state needed to generate code for a given function
- -- struct FuncState:
- -- f -- current function header (table: Proto)
- -- h -- table to find (and reuse) elements in 'k' (table: Table)
- -- prev -- enclosing function (table: FuncState)
- -- ls -- lexical state (table: LexState)
- -- L -- copy of the Lua state (table: lua_State)
- -- bl -- chain of current blocks (table: BlockCnt)
- -- pc -- next position to code (equivalent to 'ncode')
- -- lasttarget -- 'pc' of last 'jump target'
- -- jpc -- list of pending jumps to 'pc'
- -- freereg -- first free register
- -- nk -- number of elements in 'k'
- -- np -- number of elements in 'p'
- -- nlocvars -- number of elements in 'locvars'
- -- nactvar -- number of active local variables
- -- upvalues[LUAI_MAXUPVALUES] -- upvalues (table: upvaldesc)
- -- actvar[LUAI_MAXVARS] -- declared-variable stack
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- constants used by parser
- -- * picks up duplicate values from luaX if required
- ------------------------------------------------------------------------
- luaY.LUA_QS = luaX.LUA_QS or "'%s'" -- (from luaconf.h)
- luaY.SHRT_MAX = 32767 -- (from <limits.h>)
- luaY.LUAI_MAXVARS = 200 -- (luaconf.h)
- luaY.LUAI_MAXUPVALUES = 60 -- (luaconf.h)
- luaY.MAX_INT = luaX.MAX_INT or 2147483645 -- (from llimits.h)
- -- * INT_MAX-2 for 32-bit systems
- luaY.LUAI_MAXCCALLS = 200 -- (from luaconf.h)
- luaY.VARARG_HASARG = 1 -- (from lobject.h)
- -- NOTE: HASARG_MASK is value-specific
- luaY.HASARG_MASK = 2 -- this was added for a bitop in parlist()
- luaY.VARARG_ISVARARG = 2
- -- NOTE: there is some value-specific code that involves VARARG_NEEDSARG
- luaY.VARARG_NEEDSARG = 4
- luaY.LUA_MULTRET = -1 -- (lua.h)
- --[[--------------------------------------------------------------------
- -- other functions
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- LUA_QL describes how error messages quote program elements.
- -- CHANGE it if you want a different appearance. (from luaconf.h)
- ------------------------------------------------------------------------
- function luaY:LUA_QL(x)
- return "'"..x.."'"
- end
- ------------------------------------------------------------------------
- -- this is a stripped-down luaM_growvector (from lmem.h) which is a
- -- macro based on luaM_growaux (in lmem.c); all the following does is
- -- reproduce the size limit checking logic of the original function
- -- so that error behaviour is identical; all arguments preserved for
- -- convenience, even those which are unused
- -- * set the t field to nil, since this originally does a sizeof(t)
- -- * size (originally a pointer) is never updated, their final values
- -- are set by luaY:close_func(), so overall things should still work
- ------------------------------------------------------------------------
- function luaY:growvector(L, v, nelems, size, t, limit, e)
- if nelems >= limit then
- error(e) -- was luaG_runerror
- end
- end
- ------------------------------------------------------------------------
- -- initialize a new function prototype structure (from lfunc.c)
- -- * used only in open_func()
- ------------------------------------------------------------------------
- function luaY:newproto(L)
- local f = {} -- Proto
- -- luaC_link(L, obj2gco(f), LUA_TPROTO); /* GC */
- f.k = {}
- f.sizek = 0
- f.p = {}
- f.sizep = 0
- f.code = {}
- f.sizecode = 0
- f.sizelineinfo = 0
- f.sizeupvalues = 0
- f.nups = 0
- f.upvalues = {}
- f.numparams = 0
- f.is_vararg = 0
- f.maxstacksize = 0
- f.lineinfo = {}
- f.sizelocvars = 0
- f.locvars = {}
- f.lineDefined = 0
- f.lastlinedefined = 0
- f.source = nil
- return f
- end
- ------------------------------------------------------------------------
- -- converts an integer to a "floating point byte", represented as
- -- (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if
- -- eeeee != 0 and (xxx) otherwise.
- ------------------------------------------------------------------------
- function luaY:int2fb(x)
- local e = 0 -- exponent
- while x >= 16 do
- x = math.floor((x + 1) / 2)
- e = e + 1
- end
- if x < 8 then
- return x
- else
- return ((e + 1) * 8) + (x - 8)
- end
- end
- --[[--------------------------------------------------------------------
- -- parser functions
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- true of the kind of expression produces multiple return values
- ------------------------------------------------------------------------
- function luaY:hasmultret(k)
- return k == "VCALL" or k == "VVARARG"
- end
- ------------------------------------------------------------------------
- -- convenience function to access active local i, returns entry
- ------------------------------------------------------------------------
- function luaY:getlocvar(fs, i)
- return fs.f.locvars[ fs.actvar[i] ]
- end
- ------------------------------------------------------------------------
- -- check a limit, string m provided as an error message
- ------------------------------------------------------------------------
- function luaY:checklimit(fs, v, l, m)
- if v > l then self:errorlimit(fs, l, m) end
- end
- --[[--------------------------------------------------------------------
- -- nodes for block list (list of active blocks)
- -- struct BlockCnt:
- -- previous -- chain (table: BlockCnt)
- -- breaklist -- list of jumps out of this loop
- -- nactvar -- # active local variables outside the breakable structure
- -- upval -- true if some variable in the block is an upvalue (boolean)
- -- isbreakable -- true if 'block' is a loop (boolean)
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- prototypes for recursive non-terminal functions
- ------------------------------------------------------------------------
- -- prototypes deleted; not required in Lua
- ------------------------------------------------------------------------
- -- reanchor if last token is has a constant string, see close_func()
- -- * used only in close_func()
- ------------------------------------------------------------------------
- function luaY:anchor_token(ls)
- if ls.t.token == "TK_NAME" or ls.t.token == "TK_STRING" then
- -- not relevant to Lua implementation of parser
- -- local ts = ls.t.seminfo
- -- luaX_newstring(ls, getstr(ts), ts->tsv.len); /* C */
- end
- end
- ------------------------------------------------------------------------
- -- throws a syntax error if token expected is not there
- ------------------------------------------------------------------------
- function luaY:error_expected(ls, token)
- luaX:syntaxerror(ls,
- string.format(self.LUA_QS.." expected", luaX:token2str(ls, token)))
- end
- ------------------------------------------------------------------------
- -- prepares error message for display, for limits exceeded
- -- * used only in checklimit()
- ------------------------------------------------------------------------
- function luaY:errorlimit(fs, limit, what)
- local msg = (fs.f.linedefined == 0) and
- string.format("main function has more than %d %s", limit, what) or
- string.format("function at line %d has more than %d %s",
- fs.f.linedefined, limit, what)
- luaX:lexerror(fs.ls, msg, 0)
- end
- ------------------------------------------------------------------------
- -- tests for a token, returns outcome
- -- * return value changed to boolean
- ------------------------------------------------------------------------
- function luaY:testnext(ls, c)
- if ls.t.token == c then
- luaX:next(ls)
- return true
- else
- return false
- end
- end
- ------------------------------------------------------------------------
- -- check for existence of a token, throws error if not found
- ------------------------------------------------------------------------
- function luaY:check(ls, c)
- if ls.t.token ~= c then
- self:error_expected(ls, c)
- end
- end
- ------------------------------------------------------------------------
- -- verify existence of a token, then skip it
- ------------------------------------------------------------------------
- function luaY:checknext(ls, c)
- self:check(ls, c)
- luaX:next(ls)
- end
- ------------------------------------------------------------------------
- -- throws error if condition not matched
- ------------------------------------------------------------------------
- function luaY:check_condition(ls, c, msg)
- if not c then luaX:syntaxerror(ls, msg) end
- end
- ------------------------------------------------------------------------
- -- verifies token conditions are met or else throw error
- ------------------------------------------------------------------------
- function luaY:check_match(ls, what, who, where)
- if not self:testnext(ls, what) then
- if where == ls.linenumber then
- self:error_expected(ls, what)
- else
- luaX:syntaxerror(ls, string.format(
- self.LUA_QS.." expected (to close "..self.LUA_QS.." at line %d)",
- luaX:token2str(ls, what), luaX:token2str(ls, who), where))
- end
- end
- end
- ------------------------------------------------------------------------
- -- expect that token is a name, return the name
- ------------------------------------------------------------------------
- function luaY:str_checkname(ls)
- self:check(ls, "TK_NAME")
- local ts = ls.t.seminfo
- luaX:next(ls)
- return ts
- end
- ------------------------------------------------------------------------
- -- initialize a struct expdesc, expression description data structure
- ------------------------------------------------------------------------
- function luaY:init_exp(e, k, i)
- e.f, e.t = luaK.NO_JUMP, luaK.NO_JUMP
- e.k = k
- e.info = i
- end
- ------------------------------------------------------------------------
- -- adds given string s in string pool, sets e as VK
- ------------------------------------------------------------------------
- function luaY:codestring(ls, e, s)
- self:init_exp(e, "VK", luaK:stringK(ls.fs, s))
- end
- ------------------------------------------------------------------------
- -- consume a name token, adds it to string pool, sets e as VK
- ------------------------------------------------------------------------
- function luaY:checkname(ls, e)
- self:codestring(ls, e, self:str_checkname(ls))
- end
- ------------------------------------------------------------------------
- -- creates struct entry for a local variable
- -- * used only in new_localvar()
- ------------------------------------------------------------------------
- function luaY:registerlocalvar(ls, varname)
- local fs = ls.fs
- local f = fs.f
- self:growvector(ls.L, f.locvars, fs.nlocvars, f.sizelocvars,
- nil, self.SHRT_MAX, "too many local variables")
- -- loop to initialize empty f.locvar positions not required
- f.locvars[fs.nlocvars] = {} -- LocVar
- f.locvars[fs.nlocvars].varname = varname
- -- luaC_objbarrier(ls.L, f, varname) /* GC */
- local nlocvars = fs.nlocvars
- fs.nlocvars = fs.nlocvars + 1
- return nlocvars
- end
- ------------------------------------------------------------------------
- -- creates a new local variable given a name and an offset from nactvar
- -- * used in fornum(), forlist(), parlist(), body()
- ------------------------------------------------------------------------
- function luaY:new_localvarliteral(ls, v, n)
- self:new_localvar(ls, v, n)
- end
- ------------------------------------------------------------------------
- -- register a local variable, set in active variable list
- ------------------------------------------------------------------------
- function luaY:new_localvar(ls, name, n)
- local fs = ls.fs
- self:checklimit(fs, fs.nactvar + n + 1, self.LUAI_MAXVARS, "local variables")
- fs.actvar[fs.nactvar + n] = self:registerlocalvar(ls, name)
- end
- ------------------------------------------------------------------------
- -- adds nvars number of new local variables, set debug information
- ------------------------------------------------------------------------
- function luaY:adjustlocalvars(ls, nvars)
- local fs = ls.fs
- fs.nactvar = fs.nactvar + nvars
- for i = nvars, 1, -1 do
- self:getlocvar(fs, fs.nactvar - i).startpc = fs.pc
- end
- end
- ------------------------------------------------------------------------
- -- removes a number of locals, set debug information
- ------------------------------------------------------------------------
- function luaY:removevars(ls, tolevel)
- local fs = ls.fs
- while fs.nactvar > tolevel do
- fs.nactvar = fs.nactvar - 1
- self:getlocvar(fs, fs.nactvar).endpc = fs.pc
- end
- end
- ------------------------------------------------------------------------
- -- returns an existing upvalue index based on the given name, or
- -- creates a new upvalue struct entry and returns the new index
- -- * used only in singlevaraux()
- ------------------------------------------------------------------------
- function luaY:indexupvalue(fs, name, v)
- local f = fs.f
- for i = 0, f.nups - 1 do
- if fs.upvalues[i].k == v.k and fs.upvalues[i].info == v.info then
- assert(f.upvalues[i] == name)
- return i
- end
- end
- -- new one
- self:checklimit(fs, f.nups + 1, self.LUAI_MAXUPVALUES, "upvalues")
- self:growvector(fs.L, f.upvalues, f.nups, f.sizeupvalues,
- nil, self.MAX_INT, "")
- -- loop to initialize empty f.upvalues positions not required
- f.upvalues[f.nups] = name
- -- luaC_objbarrier(fs->L, f, name); /* GC */
- assert(v.k == "VLOCAL" or v.k == "VUPVAL")
- -- this is a partial copy; only k & info fields used
- fs.upvalues[f.nups] = { k = v.k, info = v.info }
- local nups = f.nups
- f.nups = f.nups + 1
- return nups
- end
- ------------------------------------------------------------------------
- -- search the local variable namespace of the given fs for a match
- -- * used only in singlevaraux()
- ------------------------------------------------------------------------
- function luaY:searchvar(fs, n)
- for i = fs.nactvar - 1, 0, -1 do
- if n == self:getlocvar(fs, i).varname then
- return i
- end
- end
- return -1 -- not found
- end
- ------------------------------------------------------------------------
- -- * mark upvalue flags in function states up to a given level
- -- * used only in singlevaraux()
- ------------------------------------------------------------------------
- function luaY:markupval(fs, level)
- local bl = fs.bl
- while bl and bl.nactvar > level do bl = bl.previous end
- if bl then bl.upval = true end
- end
- ------------------------------------------------------------------------
- -- handle locals, globals and upvalues and related processing
- -- * search mechanism is recursive, calls itself to search parents
- -- * used only in singlevar()
- ------------------------------------------------------------------------
- function luaY:singlevaraux(fs, n, var, base)
- if fs == nil then -- no more levels?
- self:init_exp(var, "VGLOBAL", luaP.NO_REG) -- default is global variable
- return "VGLOBAL"
- else
- local v = self:searchvar(fs, n) -- look up at current level
- if v >= 0 then
- self:init_exp(var, "VLOCAL", v)
- if base == 0 then
- self:markupval(fs, v) -- local will be used as an upval
- end
- return "VLOCAL"
- else -- not found at current level; try upper one
- if self:singlevaraux(fs.prev, n, var, 0) == "VGLOBAL" then
- return "VGLOBAL"
- end
- var.info = self:indexupvalue(fs, n, var) -- else was LOCAL or UPVAL
- var.k = "VUPVAL" -- upvalue in this level
- return "VUPVAL"
- end--if v
- end--if fs
- end
- ------------------------------------------------------------------------
- -- consume a name token, creates a variable (global|local|upvalue)
- -- * used in prefixexp(), funcname()
- ------------------------------------------------------------------------
- function luaY:singlevar(ls, var)
- local varname = self:str_checkname(ls)
- local fs = ls.fs
- if self:singlevaraux(fs, varname, var, 1) == "VGLOBAL" then
- var.info = luaK:stringK(fs, varname) -- info points to global name
- end
- end
- ------------------------------------------------------------------------
- -- adjust RHS to match LHS in an assignment
- -- * used in assignment(), forlist(), localstat()
- ------------------------------------------------------------------------
- function luaY:adjust_assign(ls, nvars, nexps, e)
- local fs = ls.fs
- local extra = nvars - nexps
- if self:hasmultret(e.k) then
- extra = extra + 1 -- includes call itself
- if extra <= 0 then extra = 0 end
- luaK:setreturns(fs, e, extra) -- last exp. provides the difference
- if extra > 1 then luaK:reserveregs(fs, extra - 1) end
- else
- if e.k ~= "VVOID" then luaK:exp2nextreg(fs, e) end -- close last expression
- if extra > 0 then
- local reg = fs.freereg
- luaK:reserveregs(fs, extra)
- luaK:_nil(fs, reg, extra)
- end
- end
- end
- ------------------------------------------------------------------------
- -- tracks and limits parsing depth, assert check at end of parsing
- ------------------------------------------------------------------------
- function luaY:enterlevel(ls)
- ls.L.nCcalls = ls.L.nCcalls + 1
- if ls.L.nCcalls > self.LUAI_MAXCCALLS then
- luaX:lexerror(ls, "chunk has too many syntax levels", 0)
- end
- end
- ------------------------------------------------------------------------
- -- tracks parsing depth, a pair with luaY:enterlevel()
- ------------------------------------------------------------------------
- function luaY:leavelevel(ls)
- ls.L.nCcalls = ls.L.nCcalls - 1
- end
- ------------------------------------------------------------------------
- -- enters a code unit, initializes elements
- ------------------------------------------------------------------------
- function luaY:enterblock(fs, bl, isbreakable)
- bl.breaklist = luaK.NO_JUMP
- bl.isbreakable = isbreakable
- bl.nactvar = fs.nactvar
- bl.upval = false
- bl.previous = fs.bl
- fs.bl = bl
- assert(fs.freereg == fs.nactvar)
- end
- ------------------------------------------------------------------------
- -- leaves a code unit, close any upvalues
- ------------------------------------------------------------------------
- function luaY:leaveblock(fs)
- local bl = fs.bl
- fs.bl = bl.previous
- self:removevars(fs.ls, bl.nactvar)
- if bl.upval then
- luaK:codeABC(fs, "OP_CLOSE", bl.nactvar, 0, 0)
- end
- -- a block either controls scope or breaks (never both)
- assert(not bl.isbreakable or not bl.upval)
- assert(bl.nactvar == fs.nactvar)
- fs.freereg = fs.nactvar -- free registers
- luaK:patchtohere(fs, bl.breaklist)
- end
- ------------------------------------------------------------------------
- -- implement the instantiation of a function prototype, append list of
- -- upvalues after the instantiation instruction
- -- * used only in body()
- ------------------------------------------------------------------------
- function luaY:pushclosure(ls, func, v)
- local fs = ls.fs
- local f = fs.f
- self:growvector(ls.L, f.p, fs.np, f.sizep, nil,
- luaP.MAXARG_Bx, "constant table overflow")
- -- loop to initialize empty f.p positions not required
- f.p[fs.np] = func.f
- fs.np = fs.np + 1
- -- luaC_objbarrier(ls->L, f, func->f); /* C */
- self:init_exp(v, "VRELOCABLE", luaK:codeABx(fs, "OP_CLOSURE", 0, fs.np - 1))
- for i = 0, func.f.nups - 1 do
- local o = (func.upvalues[i].k == "VLOCAL") and "OP_MOVE" or "OP_GETUPVAL"
- luaK:codeABC(fs, o, 0, func.upvalues[i].info, 0)
- end
- end
- ------------------------------------------------------------------------
- -- opening of a function
- ------------------------------------------------------------------------
- function luaY:open_func(ls, fs)
- local L = ls.L
- local f = self:newproto(ls.L)
- fs.f = f
- fs.prev = ls.fs -- linked list of funcstates
- fs.ls = ls
- fs.L = L
- ls.fs = fs
- fs.pc = 0
- fs.lasttarget = -1
- fs.jpc = luaK.NO_JUMP
- fs.freereg = 0
- fs.nk = 0
- fs.np = 0
- fs.nlocvars = 0
- fs.nactvar = 0
- fs.bl = nil
- f.source = ls.source
- f.maxstacksize = 2 -- registers 0/1 are always valid
- fs.h = {} -- constant table; was luaH_new call
- -- anchor table of constants and prototype (to avoid being collected)
- -- sethvalue2s(L, L->top, fs->h); incr_top(L); /* C */
- -- setptvalue2s(L, L->top, f); incr_top(L);
- end
- ------------------------------------------------------------------------
- -- closing of a function
- ------------------------------------------------------------------------
- function luaY:close_func(ls)
- local L = ls.L
- local fs = ls.fs
- local f = fs.f
- self:removevars(ls, 0)
- luaK:ret(fs, 0, 0) -- final return
- -- luaM_reallocvector deleted for f->code, f->lineinfo, f->k, f->p,
- -- f->locvars, f->upvalues; not required for Lua table arrays
- f.sizecode = fs.pc
- f.sizelineinfo = fs.pc
- f.sizek = fs.nk
- f.sizep = fs.np
- f.sizelocvars = fs.nlocvars
- f.sizeupvalues = f.nups
- --assert(luaG_checkcode(f)) -- currently not implemented
- assert(fs.bl == nil)
- ls.fs = fs.prev
- -- the following is not required for this implementation; kept here
- -- for completeness
- -- L->top -= 2; /* remove table and prototype from the stack */
- -- last token read was anchored in defunct function; must reanchor it
- if fs then self:anchor_token(ls) end
- end
- ------------------------------------------------------------------------
- -- parser initialization function
- -- * note additional sub-tables needed for LexState, FuncState
- ------------------------------------------------------------------------
- function luaY:parser(L, z, buff, name)
- local lexstate = {} -- LexState
- lexstate.t = {}
- lexstate.lookahead = {}
- local funcstate = {} -- FuncState
- funcstate.upvalues = {}
- funcstate.actvar = {}
- -- the following nCcalls initialization added for convenience
- L.nCcalls = 0
- lexstate.buff = buff
- luaX:setinput(L, lexstate, z, name)
- self:open_func(lexstate, funcstate)
- funcstate.f.is_vararg = self.VARARG_ISVARARG -- main func. is always vararg
- luaX:next(lexstate) -- read first token
- self:chunk(lexstate)
- self:check(lexstate, "TK_EOS")
- self:close_func(lexstate)
- assert(funcstate.prev == nil)
- assert(funcstate.f.nups == 0)
- assert(lexstate.fs == nil)
- return funcstate.f
- end
- --[[--------------------------------------------------------------------
- -- GRAMMAR RULES
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- parse a function name suffix, for function call specifications
- -- * used in primaryexp(), funcname()
- ------------------------------------------------------------------------
- function luaY:field(ls, v)
- -- field -> ['.' | ':'] NAME
- local fs = ls.fs
- local key = {} -- expdesc
- luaK:exp2anyreg(fs, v)
- luaX:next(ls) -- skip the dot or colon
- self:checkname(ls, key)
- luaK:indexed(fs, v, key)
- end
- ------------------------------------------------------------------------
- -- parse a table indexing suffix, for constructors, expressions
- -- * used in recfield(), primaryexp()
- ------------------------------------------------------------------------
- function luaY:yindex(ls, v)
- -- index -> '[' expr ']'
- luaX:next(ls) -- skip the '['
- self:expr(ls, v)
- luaK:exp2val(ls.fs, v)
- self:checknext(ls, "]")
- end
- --[[--------------------------------------------------------------------
- -- Rules for Constructors
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- struct ConsControl:
- -- v -- last list item read (table: struct expdesc)
- -- t -- table descriptor (table: struct expdesc)
- -- nh -- total number of 'record' elements
- -- na -- total number of array elements
- -- tostore -- number of array elements pending to be stored
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- parse a table record (hash) field
- -- * used in constructor()
- ------------------------------------------------------------------------
- function luaY:recfield(ls, cc)
- -- recfield -> (NAME | '['exp1']') = exp1
- local fs = ls.fs
- local reg = ls.fs.freereg
- local key, val = {}, {} -- expdesc
- if ls.t.token == "TK_NAME" then
- self:checklimit(fs, cc.nh, self.MAX_INT, "items in a constructor")
- self:checkname(ls, key)
- else -- ls->t.token == '['
- self:yindex(ls, key)
- end
- cc.nh = cc.nh + 1
- self:checknext(ls, "=")
- local rkkey = luaK:exp2RK(fs, key)
- self:expr(ls, val)
- luaK:codeABC(fs, "OP_SETTABLE", cc.t.info, rkkey, luaK:exp2RK(fs, val))
- fs.freereg = reg -- free registers
- end
- ------------------------------------------------------------------------
- -- emit a set list instruction if enough elements (LFIELDS_PER_FLUSH)
- -- * used in constructor()
- ------------------------------------------------------------------------
- function luaY:closelistfield(fs, cc)
- if cc.v.k == "VVOID" then return end -- there is no list item
- luaK:exp2nextreg(fs, cc.v)
- cc.v.k = "VVOID"
- if cc.tostore == luaP.LFIELDS_PER_FLUSH then
- luaK:setlist(fs, cc.t.info, cc.na, cc.tostore) -- flush
- cc.tostore = 0 -- no more items pending
- end
- end
- ------------------------------------------------------------------------
- -- emit a set list instruction at the end of parsing list constructor
- -- * used in constructor()
- ------------------------------------------------------------------------
- function luaY:lastlistfield(fs, cc)
- if cc.tostore == 0 then return end
- if self:hasmultret(cc.v.k) then
- luaK:setmultret(fs, cc.v)
- luaK:setlist(fs, cc.t.info, cc.na, self.LUA_MULTRET)
- cc.na = cc.na - 1 -- do not count last expression (unknown number of elements)
- else
- if cc.v.k ~= "VVOID" then
- luaK:exp2nextreg(fs, cc.v)
- end
- luaK:setlist(fs, cc.t.info, cc.na, cc.tostore)
- end
- end
- ------------------------------------------------------------------------
- -- parse a table list (array) field
- -- * used in constructor()
- ------------------------------------------------------------------------
- function luaY:listfield(ls, cc)
- self:expr(ls, cc.v)
- self:checklimit(ls.fs, cc.na, self.MAX_INT, "items in a constructor")
- cc.na = cc.na + 1
- cc.tostore = cc.tostore + 1
- end
- ------------------------------------------------------------------------
- -- parse a table constructor
- -- * used in funcargs(), simpleexp()
- ------------------------------------------------------------------------
- function luaY:constructor(ls, t)
- -- constructor -> '{' [ field { fieldsep field } [ fieldsep ] ] '}'
- -- field -> recfield | listfield
- -- fieldsep -> ',' | ';'
- local fs = ls.fs
- local line = ls.linenumber
- local pc = luaK:codeABC(fs, "OP_NEWTABLE", 0, 0, 0)
- local cc = {} -- ConsControl
- cc.v = {}
- cc.na, cc.nh, cc.tostore = 0, 0, 0
- cc.t = t
- self:init_exp(t, "VRELOCABLE", pc)
- self:init_exp(cc.v, "VVOID", 0) -- no value (yet)
- luaK:exp2nextreg(ls.fs, t) -- fix it at stack top (for gc)
- self:checknext(ls, "{")
- repeat
- assert(cc.v.k == "VVOID" or cc.tostore > 0)
- if ls.t.token == "}" then break end
- self:closelistfield(fs, cc)
- local c = ls.t.token
- if c == "TK_NAME" then -- may be listfields or recfields
- luaX:lookahead(ls)
- if ls.lookahead.token ~= "=" then -- expression?
- self:listfield(ls, cc)
- else
- self:recfield(ls, cc)
- end
- elseif c == "[" then -- constructor_item -> recfield
- self:recfield(ls, cc)
- else -- constructor_part -> listfield
- self:listfield(ls, cc)
- end
- until not self:testnext(ls, ",") and not self:testnext(ls, ";")
- self:check_match(ls, "}", "{", line)
- self:lastlistfield(fs, cc)
- luaP:SETARG_B(fs.f.code[pc], self:int2fb(cc.na)) -- set initial array size
- luaP:SETARG_C(fs.f.code[pc], self:int2fb(cc.nh)) -- set initial table size
- end
- -- }======================================================================
- ------------------------------------------------------------------------
- -- parse the arguments (parameters) of a function declaration
- -- * used in body()
- ------------------------------------------------------------------------
- function luaY:parlist(ls)
- -- parlist -> [ param { ',' param } ]
- local fs = ls.fs
- local f = fs.f
- local nparams = 0
- f.is_vararg = 0
- if ls.t.token ~= ")" then -- is 'parlist' not empty?
- repeat
- local c = ls.t.token
- if c == "TK_NAME" then -- param -> NAME
- self:new_localvar(ls, self:str_checkname(ls), nparams)
- nparams = nparams + 1
- elseif c == "TK_DOTS" then -- param -> `...'
- luaX:next(ls)
- -- [[
- -- #if defined(LUA_COMPAT_VARARG)
- -- use `arg' as default name
- self:new_localvarliteral(ls, "arg", nparams)
- nparams = nparams + 1
- f.is_vararg = self.VARARG_HASARG + self.VARARG_NEEDSARG
- -- #endif
- --]]
- f.is_vararg = f.is_vararg + self.VARARG_ISVARARG
- else
- luaX:syntaxerror(ls, "<name> or "..self:LUA_QL("...").." expected")
- end
- until f.is_vararg ~= 0 or not self:testnext(ls, ",")
- end--if
- self:adjustlocalvars(ls, nparams)
- -- NOTE: the following works only when HASARG_MASK is 2!
- f.numparams = fs.nactvar - (f.is_vararg % self.HASARG_MASK)
- luaK:reserveregs(fs, fs.nactvar) -- reserve register for parameters
- end
- ------------------------------------------------------------------------
- -- parse function declaration body
- -- * used in simpleexp(), localfunc(), funcstat()
- ------------------------------------------------------------------------
- function luaY:body(ls, e, needself, line)
- -- body -> '(' parlist ')' chunk END
- local new_fs = {} -- FuncState
- new_fs.upvalues = {}
- new_fs.actvar = {}
- self:open_func(ls, new_fs)
- new_fs.f.lineDefined = line
- self:checknext(ls, "(")
- if needself then
- self:new_localvarliteral(ls, "self", 0)
- self:adjustlocalvars(ls, 1)
- end
- self:parlist(ls)
- self:checknext(ls, ")")
- self:chunk(ls)
- new_fs.f.lastlinedefined = ls.linenumber
- self:check_match(ls, "TK_END", "TK_FUNCTION", line)
- self:close_func(ls)
- self:pushclosure(ls, new_fs, e)
- end
- ------------------------------------------------------------------------
- -- parse a list of comma-separated expressions
- -- * used is multiple locations
- ------------------------------------------------------------------------
- function luaY:explist1(ls, v)
- -- explist1 -> expr { ',' expr }
- local n = 1 -- at least one expression
- self:expr(ls, v)
- while self:testnext(ls, ",") do
- luaK:exp2nextreg(ls.fs, v)
- self:expr(ls, v)
- n = n + 1
- end
- return n
- end
- ------------------------------------------------------------------------
- -- parse the parameters of a function call
- -- * contrast with parlist(), used in function declarations
- -- * used in primaryexp()
- ------------------------------------------------------------------------
- function luaY:funcargs(ls, f)
- local fs = ls.fs
- local args = {} -- expdesc
- local nparams
- local line = ls.linenumber
- local c = ls.t.token
- if c == "(" then -- funcargs -> '(' [ explist1 ] ')'
- if line ~= ls.lastline then
- luaX:syntaxerror(ls, "ambiguous syntax (function call x new statement)")
- end
- luaX:next(ls)
- if ls.t.token == ")" then -- arg list is empty?
- args.k = "VVOID"
- else
- self:explist1(ls, args)
- luaK:setmultret(fs, args)
- end
- self:check_match(ls, ")", "(", line)
- elseif c == "{" then -- funcargs -> constructor
- self:constructor(ls, args)
- elseif c == "TK_STRING" then -- funcargs -> STRING
- self:codestring(ls, args, ls.t.seminfo)
- luaX:next(ls) -- must use 'seminfo' before 'next'
- else
- luaX:syntaxerror(ls, "function arguments expected")
- return
- end
- assert(f.k == "VNONRELOC")
- local base = f.info -- base register for call
- if self:hasmultret(args.k) then
- nparams = self.LUA_MULTRET -- open call
- else
- if args.k ~= "VVOID" then
- luaK:exp2nextreg(fs, args) -- close last argument
- end
- nparams = fs.freereg - (base + 1)
- end
- self:init_exp(f, "VCALL", luaK:codeABC(fs, "OP_CALL", base, nparams + 1, 2))
- luaK:fixline(fs, line)
- fs.freereg = base + 1 -- call remove function and arguments and leaves
- -- (unless changed) one result
- end
- --[[--------------------------------------------------------------------
- -- Expression parsing
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- parses an expression in parentheses or a single variable
- -- * used in primaryexp()
- ------------------------------------------------------------------------
- function luaY:prefixexp(ls, v)
- -- prefixexp -> NAME | '(' expr ')'
- local c = ls.t.token
- if c == "(" then
- local line = ls.linenumber
- luaX:next(ls)
- self:expr(ls, v)
- self:check_match(ls, ")", "(", line)
- luaK:dischargevars(ls.fs, v)
- elseif c == "TK_NAME" then
- self:singlevar(ls, v)
- else
- luaX:syntaxerror(ls, "unexpected symbol")
- end--if c
- return
- end
- ------------------------------------------------------------------------
- -- parses a prefixexp (an expression in parentheses or a single variable)
- -- or a function call specification
- -- * used in simpleexp(), assignment(), exprstat()
- ------------------------------------------------------------------------
- function luaY:primaryexp(ls, v)
- -- primaryexp ->
- -- prefixexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs }
- local fs = ls.fs
- self:prefixexp(ls, v)
- while true do
- local c = ls.t.token
- if c == "." then -- field
- self:field(ls, v)
- elseif c == "[" then -- '[' exp1 ']'
- local key = {} -- expdesc
- luaK:exp2anyreg(fs, v)
- self:yindex(ls, key)
- luaK:indexed(fs, v, key)
- elseif c == ":" then -- ':' NAME funcargs
- local key = {} -- expdesc
- luaX:next(ls)
- self:checkname(ls, key)
- luaK:_self(fs, v, key)
- self:funcargs(ls, v)
- elseif c == "(" or c == "TK_STRING" or c == "{" then -- funcargs
- luaK:exp2nextreg(fs, v)
- self:funcargs(ls, v)
- else
- return
- end--if c
- end--while
- end
- ------------------------------------------------------------------------
- -- parses general expression types, constants handled here
- -- * used in subexpr()
- ------------------------------------------------------------------------
- function luaY:simpleexp(ls, v)
- -- simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |
- -- constructor | FUNCTION body | primaryexp
- local c = ls.t.token
- if c == "TK_NUMBER" then
- self:init_exp(v, "VKNUM", 0)
- v.nval = ls.t.seminfo
- elseif c == "TK_STRING" then
- self:codestring(ls, v, ls.t.seminfo)
- elseif c == "TK_NIL" then
- self:init_exp(v, "VNIL", 0)
- elseif c == "TK_TRUE" then
- self:init_exp(v, "VTRUE", 0)
- elseif c == "TK_FALSE" then
- self:init_exp(v, "VFALSE", 0)
- elseif c == "TK_DOTS" then -- vararg
- local fs = ls.fs
- self:check_condition(ls, fs.f.is_vararg ~= 0,
- "cannot use "..self:LUA_QL("...").." outside a vararg function");
- -- NOTE: the following substitutes for a bitop, but is value-specific
- local is_vararg = fs.f.is_vararg
- if is_vararg >= self.VARARG_NEEDSARG then
- fs.f.is_vararg = is_vararg - self.VARARG_NEEDSARG -- don't need 'arg'
- end
- self:init_exp(v, "VVARARG", luaK:codeABC(fs, "OP_VARARG", 0, 1, 0))
- elseif c == "{" then -- constructor
- self:constructor(ls, v)
- return
- elseif c == "TK_FUNCTION" then
- luaX:next(ls)
- self:body(ls, v, false, ls.linenumber)
- return
- else
- self:primaryexp(ls, v)
- return
- end--if c
- luaX:next(ls)
- end
- ------------------------------------------------------------------------
- -- Translates unary operators tokens if found, otherwise returns
- -- OPR_NOUNOPR. getunopr() and getbinopr() are used in subexpr().
- -- * used in subexpr()
- ------------------------------------------------------------------------
- function luaY:getunopr(op)
- if op == "TK_NOT" then
- return "OPR_NOT"
- elseif op == "-" then
- return "OPR_MINUS"
- elseif op == "#" then
- return "OPR_LEN"
- else
- return "OPR_NOUNOPR"
- end
- end
- ------------------------------------------------------------------------
- -- Translates binary operator tokens if found, otherwise returns
- -- OPR_NOBINOPR. Code generation uses OPR_* style tokens.
- -- * used in subexpr()
- ------------------------------------------------------------------------
- luaY.getbinopr_table = {
- ["+"] = "OPR_ADD",
- ["-"] = "OPR_SUB",
- ["*"] = "OPR_MUL",
- ["/"] = "OPR_DIV",
- ["%"] = "OPR_MOD",
- ["^"] = "OPR_POW",
- ["TK_CONCAT"] = "OPR_CONCAT",
- ["TK_NE"] = "OPR_NE",
- ["TK_EQ"] = "OPR_EQ",
- ["<"] = "OPR_LT",
- ["TK_LE"] = "OPR_LE",
- [">"] = "OPR_GT",
- ["TK_GE"] = "OPR_GE",
- ["TK_AND"] = "OPR_AND",
- ["TK_OR"] = "OPR_OR",
- }
- function luaY:getbinopr(op)
- local opr = self.getbinopr_table[op]
- if opr then return opr else return "OPR_NOBINOPR" end
- end
- ------------------------------------------------------------------------
- -- the following priority table consists of pairs of left/right values
- -- for binary operators (was a static const struct); grep for ORDER OPR
- -- * the following struct is replaced:
- -- static const struct {
- -- lu_byte left; /* left priority for each binary operator */
- -- lu_byte right; /* right priority */
- -- } priority[] = { /* ORDER OPR */
- ------------------------------------------------------------------------
- luaY.priority = {
- {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, -- `+' `-' `/' `%'
- {10, 9}, {5, 4}, -- power and concat (right associative)
- {3, 3}, {3, 3}, -- equality
- {3, 3}, {3, 3}, {3, 3}, {3, 3}, -- order
- {2, 2}, {1, 1} -- logical (and/or)
- }
- luaY.UNARY_PRIORITY = 8 -- priority for unary operators
- ------------------------------------------------------------------------
- -- Parse subexpressions. Includes handling of unary operators and binary
- -- operators. A subexpr is given the rhs priority level of the operator
- -- immediately left of it, if any (limit is -1 if none,) and if a binop
- -- is found, limit is compared with the lhs priority level of the binop
- -- in order to determine which executes first.
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -- subexpr -> (simpleexp | unop subexpr) { binop subexpr }
- -- where 'binop' is any binary operator with a priority higher than 'limit'
- -- * for priority lookups with self.priority[], 1=left and 2=right
- -- * recursively called
- -- * used in expr()
- ------------------------------------------------------------------------
- function luaY:subexpr(ls, v, limit)
- self:enterlevel(ls)
- local uop = self:getunopr(ls.t.token)
- if uop ~= "OPR_NOUNOPR" then
- luaX:next(ls)
- self:subexpr(ls, v, self.UNARY_PRIORITY)
- luaK:prefix(ls.fs, uop, v)
- else
- self:simpleexp(ls, v)
- end
- -- expand while operators have priorities higher than 'limit'
- local op = self:getbinopr(ls.t.token)
- while op ~= "OPR_NOBINOPR" and self.priority[luaK.BinOpr[op] + 1][1] > limit do
- local v2 = {} -- expdesc
- luaX:next(ls)
- luaK:infix(ls.fs, op, v)
- -- read sub-expression with higher priority
- local nextop = self:subexpr(ls, v2, self.priority[luaK.BinOpr[op] + 1][2])
- luaK:posfix(ls.fs, op, v, v2)
- op = nextop
- end
- self:leavelevel(ls)
- return op -- return first untreated operator
- end
- ------------------------------------------------------------------------
- -- Expression parsing starts here. Function subexpr is entered with the
- -- left operator (which is non-existent) priority of -1, which is lower
- -- than all actual operators. Expr information is returned in parm v.
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaY:expr(ls, v)
- self:subexpr(ls, v, 0)
- end
- -- }====================================================================
- --[[--------------------------------------------------------------------
- -- Rules for Statements
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- checks next token, used as a look-ahead
- -- * returns boolean instead of 0|1
- -- * used in retstat(), chunk()
- ------------------------------------------------------------------------
- function luaY:block_follow(token)
- if token == "TK_ELSE" or token == "TK_ELSEIF" or token == "TK_END"
- or token == "TK_UNTIL" or token == "TK_EOS" then
- return true
- else
- return false
- end
- end
- ------------------------------------------------------------------------
- -- parse a code block or unit
- -- * used in multiple functions
- ------------------------------------------------------------------------
- function luaY:block(ls)
- -- block -> chunk
- local fs = ls.fs
- local bl = {} -- BlockCnt
- self:enterblock(fs, bl, false)
- self:chunk(ls)
- assert(bl.breaklist == luaK.NO_JUMP)
- self:leaveblock(fs)
- end
- ------------------------------------------------------------------------
- -- structure to chain all variables in the left-hand side of an
- -- assignment
- -- struct LHS_assign:
- -- prev -- (table: struct LHS_assign)
- -- v -- variable (global, local, upvalue, or indexed) (table: expdesc)
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -- check whether, in an assignment to a local variable, the local variable
- -- is needed in a previous assignment (to a table). If so, save original
- -- local value in a safe place and use this safe copy in the previous
- -- assignment.
- -- * used in assignment()
- ------------------------------------------------------------------------
- function luaY:check_conflict(ls, lh, v)
- local fs = ls.fs
- local extra = fs.freereg -- eventual position to save local variable
- local conflict = false
- while lh do
- if lh.v.k == "VINDEXED" then
- if lh.v.info == v.info then -- conflict?
- conflict = true
- lh.v.info = extra -- previous assignment will use safe copy
- end
- if lh.v.aux == v.info then -- conflict?
- conflict = true
- lh.v.aux = extra -- previous assignment will use safe copy
- end
- end
- lh = lh.prev
- end
- if conflict then
- luaK:codeABC(fs, "OP_MOVE", fs.freereg, v.info, 0) -- make copy
- luaK:reserveregs(fs, 1)
- end
- end
- ------------------------------------------------------------------------
- -- parse a variable assignment sequence
- -- * recursively called
- -- * used in exprstat()
- ------------------------------------------------------------------------
- function luaY:assignment(ls, lh, nvars)
- local e = {} -- expdesc
- -- test was: VLOCAL <= lh->v.k && lh->v.k <= VINDEXED
- local c = lh.v.k
- self:check_condition(ls, c == "VLOCAL" or c == "VUPVAL" or c == "VGLOBAL"
- or c == "VINDEXED", "syntax error")
- if self:testnext(ls, ",") then -- assignment -> ',' primaryexp assignment
- local nv = {} -- LHS_assign
- nv.v = {}
- nv.prev = lh
- self:primaryexp(ls, nv.v)
- if nv.v.k == "VLOCAL" then
- self:check_conflict(ls, lh, nv.v)
- end
- self:checklimit(ls.fs, nvars, self.LUAI_MAXCCALLS - ls.L.nCcalls,
- "variables in assignment")
- self:assignment(ls, nv, nvars + 1)
- else -- assignment -> '=' explist1
- self:checknext(ls, "=")
- local nexps = self:explist1(ls, e)
- if nexps ~= nvars then
- self:adjust_assign(ls, nvars, nexps, e)
- if nexps > nvars then
- ls.fs.freereg = ls.fs.freereg - (nexps - nvars) -- remove extra values
- end
- else
- luaK:setoneret(ls.fs, e) -- close last expression
- luaK:storevar(ls.fs, lh.v, e)
- return -- avoid default
- end
- end
- self:init_exp(e, "VNONRELOC", ls.fs.freereg - 1) -- default assignment
- luaK:storevar(ls.fs, lh.v, e)
- end
- ------------------------------------------------------------------------
- -- parse condition in a repeat statement or an if control structure
- -- * used in repeatstat(), test_then_block()
- ------------------------------------------------------------------------
- function luaY:cond(ls)
- -- cond -> exp
- local v = {} -- expdesc
- self:expr(ls, v) -- read condition
- if v.k == "VNIL" then v.k = "VFALSE" end -- 'falses' are all equal here
- luaK:goiftrue(ls.fs, v)
- return v.f
- end
- ------------------------------------------------------------------------
- -- parse a break statement
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:breakstat(ls)
- -- stat -> BREAK
- local fs = ls.fs
- local bl = fs.bl
- local upval = false
- while bl and not bl.isbreakable do
- if bl.upval then upval = true end
- bl = bl.previous
- end
- if not bl then
- luaX:syntaxerror(ls, "no loop to break")
- end
- if upval then
- luaK:codeABC(fs, "OP_CLOSE", bl.nactvar, 0, 0)
- end
- bl.breaklist = luaK:concat(fs, bl.breaklist, luaK:jump(fs))
- end
- ------------------------------------------------------------------------
- -- parse a while-do control structure, body processed by block()
- -- * with dynamic array sizes, MAXEXPWHILE + EXTRAEXP limits imposed by
- -- the function's implementation can be removed
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:whilestat(ls, line)
- -- whilestat -> WHILE cond DO block END
- local fs = ls.fs
- local bl = {} -- BlockCnt
- luaX:next(ls) -- skip WHILE
- local whileinit = luaK:getlabel(fs)
- local condexit = self:cond(ls)
- self:enterblock(fs, bl, true)
- self:checknext(ls, "TK_DO")
- self:block(ls)
- luaK:patchlist(fs, luaK:jump(fs), whileinit)
- self:check_match(ls, "TK_END", "TK_WHILE", line)
- self:leaveblock(fs)
- luaK:patchtohere(fs, condexit) -- false conditions finish the loop
- end
- ------------------------------------------------------------------------
- -- parse a repeat-until control structure, body parsed by chunk()
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:repeatstat(ls, line)
- -- repeatstat -> REPEAT block UNTIL cond
- local fs = ls.fs
- local repeat_init = luaK:getlabel(fs)
- local bl1, bl2 = {}, {} -- BlockCnt
- self:enterblock(fs, bl1, true) -- loop block
- self:enterblock(fs, bl2, false) -- scope block
- luaX:next(ls) -- skip REPEAT
- self:chunk(ls)
- self:check_match(ls, "TK_UNTIL", "TK_REPEAT", line)
- local condexit = self:cond(ls) -- read condition (inside scope block)
- if not bl2.upval then -- no upvalues?
- self:leaveblock(fs) -- finish scope
- luaK:patchlist(ls.fs, condexit, repeat_init) -- close the loop
- else -- complete semantics when there are upvalues
- self:breakstat(ls) -- if condition then break
- luaK:patchtohere(ls.fs, condexit) -- else...
- self:leaveblock(fs) -- finish scope...
- luaK:patchlist(ls.fs, luaK:jump(fs), repeat_init) -- and repeat
- end
- self:leaveblock(fs) -- finish loop
- end
- ------------------------------------------------------------------------
- -- parse the single expressions needed in numerical for loops
- -- * used in fornum()
- ------------------------------------------------------------------------
- function luaY:exp1(ls)
- local e = {} -- expdesc
- self:expr(ls, e)
- local k = e.k
- luaK:exp2nextreg(ls.fs, e)
- return k
- end
- ------------------------------------------------------------------------
- -- parse a for loop body for both versions of the for loop
- -- * used in fornum(), forlist()
- ------------------------------------------------------------------------
- function luaY:forbody(ls, base, line, nvars, isnum)
- -- forbody -> DO block
- local bl = {} -- BlockCnt
- local fs = ls.fs
- self:adjustlocalvars(ls, 3) -- control variables
- self:checknext(ls, "TK_DO")
- local prep = isnum and luaK:codeAsBx(fs, "OP_FORPREP", base, luaK.NO_JUMP)
- or luaK:jump(fs)
- self:enterblock(fs, bl, false) -- scope for declared variables
- self:adjustlocalvars(ls, nvars)
- luaK:reserveregs(fs, nvars)
- self:block(ls)
- self:leaveblock(fs) -- end of scope for declared variables
- luaK:patchtohere(fs, prep)
- local endfor = isnum and luaK:codeAsBx(fs, "OP_FORLOOP", base, luaK.NO_JUMP)
- or luaK:codeABC(fs, "OP_TFORLOOP", base, 0, nvars)
- luaK:fixline(fs, line) -- pretend that `OP_FOR' starts the loop
- luaK:patchlist(fs, isnum and endfor or luaK:jump(fs), prep + 1)
- end
- ------------------------------------------------------------------------
- -- parse a numerical for loop, calls forbody()
- -- * used in forstat()
- ------------------------------------------------------------------------
- function luaY:fornum(ls, varname, line)
- -- fornum -> NAME = exp1,exp1[,exp1] forbody
- local fs = ls.fs
- local base = fs.freereg
- self:new_localvarliteral(ls, "(for index)", 0)
- self:new_localvarliteral(ls, "(for limit)", 1)
- self:new_localvarliteral(ls, "(for step)", 2)
- self:new_localvar(ls, varname, 3)
- self:checknext(ls, '=')
- self:exp1(ls) -- initial value
- self:checknext(ls, ",")
- self:exp1(ls) -- limit
- if self:testnext(ls, ",") then
- self:exp1(ls) -- optional step
- else -- default step = 1
- luaK:codeABx(fs, "OP_LOADK", fs.freereg, luaK:numberK(fs, 1))
- luaK:reserveregs(fs, 1)
- end
- self:forbody(ls, base, line, 1, true)
- end
- ------------------------------------------------------------------------
- -- parse a generic for loop, calls forbody()
- -- * used in forstat()
- ------------------------------------------------------------------------
- function luaY:forlist(ls, indexname)
- -- forlist -> NAME {,NAME} IN explist1 forbody
- local fs = ls.fs
- local e = {} -- expdesc
- local nvars = 0
- local base = fs.freereg
- -- create control variables
- self:new_localvarliteral(ls, "(for generator)", nvars)
- nvars = nvars + 1
- self:new_localvarliteral(ls, "(for state)", nvars)
- nvars = nvars + 1
- self:new_localvarliteral(ls, "(for control)", nvars)
- nvars = nvars + 1
- -- create declared variables
- self:new_localvar(ls, indexname, nvars)
- nvars = nvars + 1
- while self:testnext(ls, ",") do
- self:new_localvar(ls, self:str_checkname(ls), nvars)
- nvars = nvars + 1
- end
- self:checknext(ls, "TK_IN")
- local line = ls.linenumber
- self:adjust_assign(ls, 3, self:explist1(ls, e), e)
- luaK:checkstack(fs, 3) -- extra space to call generator
- self:forbody(ls, base, line, nvars - 3, false)
- end
- ------------------------------------------------------------------------
- -- initial parsing for a for loop, calls fornum() or forlist()
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:forstat(ls, line)
- -- forstat -> FOR (fornum | forlist) END
- local fs = ls.fs
- local bl = {} -- BlockCnt
- self:enterblock(fs, bl, true) -- scope for loop and control variables
- luaX:next(ls) -- skip `for'
- local varname = self:str_checkname(ls) -- first variable name
- local c = ls.t.token
- if c == "=" then
- self:fornum(ls, varname, line)
- elseif c == "," or c == "TK_IN" then
- self:forlist(ls, varname)
- else
- luaX:syntaxerror(ls, self:LUA_QL("=").." or "..self:LUA_QL("in").." expected")
- end
- self:check_match(ls, "TK_END", "TK_FOR", line)
- self:leaveblock(fs) -- loop scope (`break' jumps to this point)
- end
- ------------------------------------------------------------------------
- -- parse part of an if control structure, including the condition
- -- * used in ifstat()
- ------------------------------------------------------------------------
- function luaY:test_then_block(ls)
- -- test_then_block -> [IF | ELSEIF] cond THEN block
- luaX:next(ls) -- skip IF or ELSEIF
- local condexit = self:cond(ls)
- self:checknext(ls, "TK_THEN")
- self:block(ls) -- `then' part
- return condexit
- end
- ------------------------------------------------------------------------
- -- parse an if control structure
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:ifstat(ls, line)
- -- ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END
- local fs = ls.fs
- local escapelist = luaK.NO_JUMP
- local flist = self:test_then_block(ls) -- IF cond THEN block
- while ls.t.token == "TK_ELSEIF" do
- escapelist = luaK:concat(fs, escapelist, luaK:jump(fs))
- luaK:patchtohere(fs, flist)
- flist = self:test_then_block(ls) -- ELSEIF cond THEN block
- end
- if ls.t.token == "TK_ELSE" then
- escapelist = luaK:concat(fs, escapelist, luaK:jump(fs))
- luaK:patchtohere(fs, flist)
- luaX:next(ls) -- skip ELSE (after patch, for correct line info)
- self:block(ls) -- 'else' part
- else
- escapelist = luaK:concat(fs, escapelist, flist)
- end
- luaK:patchtohere(fs, escapelist)
- self:check_match(ls, "TK_END", "TK_IF", line)
- end
- ------------------------------------------------------------------------
- -- parse a local function statement
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:localfunc(ls)
- local v, b = {}, {} -- expdesc
- local fs = ls.fs
- self:new_localvar(ls, self:str_checkname(ls), 0)
- self:init_exp(v, "VLOCAL", fs.freereg)
- luaK:reserveregs(fs, 1)
- self:adjustlocalvars(ls, 1)
- self:body(ls, b, false, ls.linenumber)
- luaK:storevar(fs, v, b)
- -- debug information will only see the variable after this point!
- self:getlocvar(fs, fs.nactvar - 1).startpc = fs.pc
- end
- ------------------------------------------------------------------------
- -- parse a local variable declaration statement
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:localstat(ls)
- -- stat -> LOCAL NAME {',' NAME} ['=' explist1]
- local nvars = 0
- local nexps
- local e = {} -- expdesc
- repeat
- self:new_localvar(ls, self:str_checkname(ls), nvars)
- nvars = nvars + 1
- until not self:testnext(ls, ",")
- if self:testnext(ls, "=") then
- nexps = self:explist1(ls, e)
- else
- e.k = "VVOID"
- nexps = 0
- end
- self:adjust_assign(ls, nvars, nexps, e)
- self:adjustlocalvars(ls, nvars)
- end
- ------------------------------------------------------------------------
- -- parse a function name specification
- -- * used in funcstat()
- ------------------------------------------------------------------------
- function luaY:funcname(ls, v)
- -- funcname -> NAME {field} [':' NAME]
- local needself = false
- self:singlevar(ls, v)
- while ls.t.token == "." do
- self:field(ls, v)
- end
- if ls.t.token == ":" then
- needself = true
- self:field(ls, v)
- end
- return needself
- end
- ------------------------------------------------------------------------
- -- parse a function statement
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:funcstat(ls, line)
- -- funcstat -> FUNCTION funcname body
- local v, b = {}, {} -- expdesc
- luaX:next(ls) -- skip FUNCTION
- local needself = self:funcname(ls, v)
- self:body(ls, b, needself, line)
- luaK:storevar(ls.fs, v, b)
- luaK:fixline(ls.fs, line) -- definition 'happens' in the first line
- end
- ------------------------------------------------------------------------
- -- parse a function call with no returns or an assignment statement
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:exprstat(ls)
- -- stat -> func | assignment
- local fs = ls.fs
- local v = {} -- LHS_assign
- v.v = {}
- self:primaryexp(ls, v.v)
- if v.v.k == "VCALL" then -- stat -> func
- luaP:SETARG_C(luaK:getcode(fs, v.v), 1) -- call statement uses no results
- else -- stat -> assignment
- v.prev = nil
- self:assignment(ls, v, 1)
- end
- end
- ------------------------------------------------------------------------
- -- parse a return statement
- -- * used in statements()
- ------------------------------------------------------------------------
- function luaY:retstat(ls)
- -- stat -> RETURN explist
- local fs = ls.fs
- local e = {} -- expdesc
- local first, nret -- registers with returned values
- luaX:next(ls) -- skip RETURN
- if self:block_follow(ls.t.token) or ls.t.token == ";" then
- first, nret = 0, 0 -- return no values
- else
- nret = self:explist1(ls, e) -- optional return values
- if self:hasmultret(e.k) then
- luaK:setmultret(fs, e)
- if e.k == "VCALL" and nret == 1 then -- tail call?
- luaP:SET_OPCODE(luaK:getcode(fs, e), "OP_TAILCALL")
- assert(luaP:GETARG_A(luaK:getcode(fs, e)) == fs.nactvar)
- end
- first = fs.nactvar
- nret = self.LUA_MULTRET -- return all values
- else
- if nret == 1 then -- only one single value?
- first = luaK:exp2anyreg(fs, e)
- else
- luaK:exp2nextreg(fs, e) -- values must go to the 'stack'
- first = fs.nactvar -- return all 'active' values
- assert(nret == fs.freereg - first)
- end
- end--if
- end--if
- luaK:ret(fs, first, nret)
- end
- ------------------------------------------------------------------------
- -- initial parsing for statements, calls a lot of functions
- -- * returns boolean instead of 0|1
- -- * used in chunk()
- ------------------------------------------------------------------------
- function luaY:statement(ls)
- local line = ls.linenumber -- may be needed for error messages
- local c = ls.t.token
- if c == "TK_IF" then -- stat -> ifstat
- self:ifstat(ls, line)
- return false
- elseif c == "TK_WHILE" then -- stat -> whilestat
- self:whilestat(ls, line)
- return false
- elseif c == "TK_DO" then -- stat -> DO block END
- luaX:next(ls) -- skip DO
- self:block(ls)
- self:check_match(ls, "TK_END", "TK_DO", line)
- return false
- elseif c == "TK_FOR" then -- stat -> forstat
- self:forstat(ls, line)
- return false
- elseif c == "TK_REPEAT" then -- stat -> repeatstat
- self:repeatstat(ls, line)
- return false
- elseif c == "TK_FUNCTION" then -- stat -> funcstat
- self:funcstat(ls, line)
- return false
- elseif c == "TK_LOCAL" then -- stat -> localstat
- luaX:next(ls) -- skip LOCAL
- if self:testnext(ls, "TK_FUNCTION") then -- local function?
- self:localfunc(ls)
- else
- self:localstat(ls)
- end
- return false
- elseif c == "TK_RETURN" then -- stat -> retstat
- self:retstat(ls)
- return true -- must be last statement
- elseif c == "TK_BREAK" then -- stat -> breakstat
- luaX:next(ls) -- skip BREAK
- self:breakstat(ls)
- return true -- must be last statement
- else
- self:exprstat(ls)
- return false -- to avoid warnings
- end--if c
- end
- ------------------------------------------------------------------------
- -- parse a chunk, which consists of a bunch of statements
- -- * used in parser(), body(), block(), repeatstat()
- ------------------------------------------------------------------------
- function luaY:chunk(ls)
- -- chunk -> { stat [';'] }
- local islast = false
- self:enterlevel(ls)
- while not islast and not self:block_follow(ls.t.token) do
- islast = self:statement(ls)
- self:testnext(ls, ";")
- assert(ls.fs.f.maxstacksize >= ls.fs.freereg and
- ls.fs.freereg >= ls.fs.nactvar)
- ls.fs.freereg = ls.fs.nactvar -- free registers
- end
- self:leavelevel(ls)
- end
- -- }======================================================================
- return luaY]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX1E87DFB667CA48C2AEAEFA48C0C00C1D">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">LuaK</string>
- <string name="ScriptGuid">{2C3B786F-7F97-4344-9B7E-5ACD70991843}</string>
- <ProtectedString name="Source"><![CDATA[local type = type;
- local table = table;
- local assert = assert;
- local require = require;
- local math = math;
- local next = next;
- local string = string;
- local debug = debug;
- --[[--------------------------------------------------------------------
- lcode.lua
- Lua 5 code generator in Lua
- This file is part of Yueliang.
- Copyright (c) 2005-2007 Kein-Hong Man <khman@users.sf.net>
- The COPYRIGHT file describes the conditions
- under which this software may be distributed.
- See the ChangeLog for more information.
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- Notes:
- -- * one function manipulate a pointer argument with a simple data type
- -- (can't be emulated by a table, ambiguous), now returns that value:
- -- luaK:concat(fs, l1, l2)
- -- * luaM_growvector uses the faux luaY:growvector, for limit checking
- -- * some function parameters changed to boolean, additional code
- -- translates boolean back to 1/0 for instruction fields
- --
- -- Not implemented:
- -- * NOTE there is a failed assert in luaK:addk, a porting problem
- --
- -- Added:
- -- * constant MAXSTACK from llimits.h
- -- * luaK:ttisnumber(o) (from lobject.h)
- -- * luaK:nvalue(o) (from lobject.h)
- -- * luaK:setnilvalue(o) (from lobject.h)
- -- * luaK:setnvalue(o, x) (from lobject.h)
- -- * luaK:setbvalue(o, x) (from lobject.h)
- -- * luaK:sethvalue(o, x) (from lobject.h), parameter L deleted
- -- * luaK:setsvalue(o, x) (from lobject.h), parameter L deleted
- -- * luaK:numadd, luaK:numsub, luaK:nummul, luaK:numdiv, luaK:nummod,
- -- luaK:numpow, luaK:numunm, luaK:numisnan (from luaconf.h)
- -- * copyexp(e1, e2) added in luaK:posfix to copy expdesc struct
- --
- -- Changed in 5.1.x:
- -- * enum BinOpr has a new entry, OPR_MOD
- -- * enum UnOpr has a new entry, OPR_LEN
- -- * binopistest, unused in 5.0.x, has been deleted
- -- * macro setmultret is new
- -- * functions isnumeral, luaK_ret, boolK are new
- -- * funcion nilK was named nil_constant in 5.0.x
- -- * function interface changed: need_value, patchtestreg, concat
- -- * TObject now a TValue
- -- * functions luaK_setreturns, luaK_setoneret are new
- -- * function luaK:setcallreturns deleted, to be replaced by:
- -- luaK:setmultret, luaK:ret, luaK:setreturns, luaK:setoneret
- -- * functions constfolding, codearith, codecomp are new
- -- * luaK:codebinop has been deleted
- -- * function luaK_setlist is new
- -- * OPR_MULT renamed to OPR_MUL
- ----------------------------------------------------------------------]]
- -- requires luaP, luaX, luaY
- local luaK = {}
- local luaP = require(script.Parent.LuaP)
- local luaX = require(script.Parent.LuaX)
- ------------------------------------------------------------------------
- -- constants used by code generator
- ------------------------------------------------------------------------
- -- maximum stack for a Lua function
- luaK.MAXSTACK = 250 -- (from llimits.h)
- --[[--------------------------------------------------------------------
- -- other functions
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- emulation of TValue macros (these are from lobject.h)
- -- * TValue is a table since lcode passes references around
- -- * tt member field removed, using Lua's type() instead
- -- * for setsvalue, sethvalue, parameter L (deleted here) in lobject.h
- -- is used in an assert for testing, see checkliveness(g,obj)
- ------------------------------------------------------------------------
- function luaK:ttisnumber(o)
- if o then return type(o.value) == "number" else return false end
- end
- function luaK:nvalue(o) return o.value end
- function luaK:setnilvalue(o) o.value = nil end
- function luaK:setsvalue(o, x) o.value = x end
- luaK.setnvalue = luaK.setsvalue
- luaK.sethvalue = luaK.setsvalue
- luaK.setbvalue = luaK.setsvalue
- ------------------------------------------------------------------------
- -- The luai_num* macros define the primitive operations over numbers.
- -- * this is not the entire set of primitive operations from luaconf.h
- -- * used in luaK:constfolding()
- ------------------------------------------------------------------------
- function luaK:numadd(a, b) return a + b end
- function luaK:numsub(a, b) return a - b end
- function luaK:nummul(a, b) return a * b end
- function luaK:numdiv(a, b) return a / b end
- function luaK:nummod(a, b) return a % b end
- -- ((a) - floor((a)/(b))*(b)) /* actual, for reference */
- function luaK:numpow(a, b) return a ^ b end
- function luaK:numunm(a) return -a end
- function luaK:numisnan(a) return not a == a end
- -- a NaN cannot equal another NaN
- --[[--------------------------------------------------------------------
- -- code generator functions
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- Marks the end of a patch list. It is an invalid value both as an absolute
- -- address, and as a list link (would link an element to itself).
- ------------------------------------------------------------------------
- luaK.NO_JUMP = -1
- ------------------------------------------------------------------------
- -- grep "ORDER OPR" if you change these enums
- ------------------------------------------------------------------------
- luaK.BinOpr = {
- OPR_ADD = 0, OPR_SUB = 1, OPR_MUL = 2, OPR_DIV = 3, OPR_MOD = 4, OPR_POW = 5,
- OPR_CONCAT = 6,
- OPR_NE = 7, OPR_EQ = 8,
- OPR_LT = 9, OPR_LE = 10, OPR_GT = 11, OPR_GE = 12,
- OPR_AND = 13, OPR_OR = 14,
- OPR_NOBINOPR = 15,
- }
- -- * UnOpr is used by luaK:prefix's op argument, but not directly used
- -- because the function receives the symbols as strings, e.g. "OPR_NOT"
- luaK.UnOpr = {
- OPR_MINUS = 0, OPR_NOT = 1, OPR_LEN = 2, OPR_NOUNOPR = 3
- }
- ------------------------------------------------------------------------
- -- returns the instruction object for given e (expdesc), was a macro
- ------------------------------------------------------------------------
- function luaK:getcode(fs, e)
- return fs.f.code[e.info]
- end
- ------------------------------------------------------------------------
- -- codes an instruction with a signed Bx (sBx) field, was a macro
- -- * used in luaK:jump(), (lparser) luaY:forbody()
- ------------------------------------------------------------------------
- function luaK:codeAsBx(fs, o, A, sBx)
- return self:codeABx(fs, o, A, sBx + luaP.MAXARG_sBx)
- end
- ------------------------------------------------------------------------
- -- set the expdesc e instruction for multiple returns, was a macro
- ------------------------------------------------------------------------
- function luaK:setmultret(fs, e)
- self:setreturns(fs, e, luaY.LUA_MULTRET)
- end
- ------------------------------------------------------------------------
- -- there is a jump if patch lists are not identical, was a macro
- -- * used in luaK:exp2reg(), luaK:exp2anyreg(), luaK:exp2val()
- ------------------------------------------------------------------------
- function luaK:hasjumps(e)
- return e.t ~= e.f
- end
- ------------------------------------------------------------------------
- -- true if the expression is a constant number (for constant folding)
- -- * used in constfolding(), infix()
- ------------------------------------------------------------------------
- function luaK:isnumeral(e)
- return e.k == "VKNUM" and e.t == self.NO_JUMP and e.f == self.NO_JUMP
- end
- ------------------------------------------------------------------------
- -- codes loading of nil, optimization done if consecutive locations
- -- * used in luaK:discharge2reg(), (lparser) luaY:adjust_assign()
- ------------------------------------------------------------------------
- function luaK:_nil(fs, from, n)
- if fs.pc > fs.lasttarget then -- no jumps to current position?
- if fs.pc == 0 then -- function start?
- if from >= fs.nactvar then
- return -- positions are already clean
- end
- else
- local previous = fs.f.code[fs.pc - 1]
- if luaP:GET_OPCODE(previous) == "OP_LOADNIL" then
- local pfrom = luaP:GETARG_A(previous)
- local pto = luaP:GETARG_B(previous)
- if pfrom <= from and from <= pto + 1 then -- can connect both?
- if from + n - 1 > pto then
- luaP:SETARG_B(previous, from + n - 1)
- end
- return
- end
- end
- end
- end
- self:codeABC(fs, "OP_LOADNIL", from, from + n - 1, 0) -- else no optimization
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:jump(fs)
- local jpc = fs.jpc -- save list of jumps to here
- fs.jpc = self.NO_JUMP
- local j = self:codeAsBx(fs, "OP_JMP", 0, self.NO_JUMP)
- j = self:concat(fs, j, jpc) -- keep them on hold
- return j
- end
- ------------------------------------------------------------------------
- -- codes a RETURN instruction
- -- * used in luaY:close_func(), luaY:retstat()
- ------------------------------------------------------------------------
- function luaK:ret(fs, first, nret)
- self:codeABC(fs, "OP_RETURN", first, nret + 1, 0)
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:jumponcond(), luaK:codecomp()
- ------------------------------------------------------------------------
- function luaK:condjump(fs, op, A, B, C)
- self:codeABC(fs, op, A, B, C)
- return self:jump(fs)
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:patchlistaux(), luaK:concat()
- ------------------------------------------------------------------------
- function luaK:fixjump(fs, pc, dest)
- local jmp = fs.f.code[pc]
- local offset = dest - (pc + 1)
- assert(dest ~= self.NO_JUMP)
- if math.abs(offset) > luaP.MAXARG_sBx then
- luaX:syntaxerror(fs.ls, "control structure too long")
- end
- luaP:SETARG_sBx(jmp, offset)
- end
- ------------------------------------------------------------------------
- -- returns current 'pc' and marks it as a jump target (to avoid wrong
- -- optimizations with consecutive instructions not in the same basic block).
- -- * used in multiple locations
- -- * fs.lasttarget tested only by luaK:_nil() when optimizing OP_LOADNIL
- ------------------------------------------------------------------------
- function luaK:getlabel(fs)
- fs.lasttarget = fs.pc
- return fs.pc
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:need_value(), luaK:removevalues(), luaK:patchlistaux(),
- -- luaK:concat()
- ------------------------------------------------------------------------
- function luaK:getjump(fs, pc)
- local offset = luaP:GETARG_sBx(fs.f.code[pc])
- if offset == self.NO_JUMP then -- point to itself represents end of list
- return self.NO_JUMP -- end of list
- else
- return (pc + 1) + offset -- turn offset into absolute position
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:need_value(), luaK:patchtestreg(), luaK:invertjump()
- ------------------------------------------------------------------------
- function luaK:getjumpcontrol(fs, pc)
- local pi = fs.f.code[pc]
- local ppi = fs.f.code[pc - 1]
- if pc >= 1 and luaP:testTMode(luaP:GET_OPCODE(ppi)) ~= 0 then
- return ppi
- else
- return pi
- end
- end
- ------------------------------------------------------------------------
- -- check whether list has any jump that do not produce a value
- -- (or produce an inverted value)
- -- * return value changed to boolean
- -- * used only in luaK:exp2reg()
- ------------------------------------------------------------------------
- function luaK:need_value(fs, list)
- while list ~= self.NO_JUMP do
- local i = self:getjumpcontrol(fs, list)
- if luaP:GET_OPCODE(i) ~= "OP_TESTSET" then return true end
- list = self:getjump(fs, list)
- end
- return false -- not found
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:removevalues(), luaK:patchlistaux()
- ------------------------------------------------------------------------
- function luaK:patchtestreg(fs, node, reg)
- local i = self:getjumpcontrol(fs, node)
- if luaP:GET_OPCODE(i) ~= "OP_TESTSET" then
- return false -- cannot patch other instructions
- end
- if reg ~= luaP.NO_REG and reg ~= luaP:GETARG_B(i) then
- luaP:SETARG_A(i, reg)
- else -- no register to put value or register already has the value
- -- due to use of a table as i, i cannot be replaced by another table
- -- so the following is required; there is no change to ARG_C
- luaP:SET_OPCODE(i, "OP_TEST")
- local b = luaP:GETARG_B(i)
- luaP:SETARG_A(i, b)
- luaP:SETARG_B(i, 0)
- -- *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); /* C */
- end
- return true
- end
- ------------------------------------------------------------------------
- --
- -- * used only in luaK:codenot()
- ------------------------------------------------------------------------
- function luaK:removevalues(fs, list)
- while list ~= self.NO_JUMP do
- self:patchtestreg(fs, list, luaP.NO_REG)
- list = self:getjump(fs, list)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:dischargejpc(), luaK:patchlist(), luaK:exp2reg()
- ------------------------------------------------------------------------
- function luaK:patchlistaux(fs, list, vtarget, reg, dtarget)
- while list ~= self.NO_JUMP do
- local _next = self:getjump(fs, list)
- if self:patchtestreg(fs, list, reg) then
- self:fixjump(fs, list, vtarget)
- else
- self:fixjump(fs, list, dtarget) -- jump to default target
- end
- list = _next
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used only in luaK:code()
- ------------------------------------------------------------------------
- function luaK:dischargejpc(fs)
- self:patchlistaux(fs, fs.jpc, fs.pc, luaP.NO_REG, fs.pc)
- fs.jpc = self.NO_JUMP
- end
- ------------------------------------------------------------------------
- --
- -- * used in (lparser) luaY:whilestat(), luaY:repeatstat(), luaY:forbody()
- ------------------------------------------------------------------------
- function luaK:patchlist(fs, list, target)
- if target == fs.pc then
- self:patchtohere(fs, list)
- else
- assert(target < fs.pc)
- self:patchlistaux(fs, list, target, luaP.NO_REG, target)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:patchtohere(fs, list)
- self:getlabel(fs)
- fs.jpc = self:concat(fs, fs.jpc, list)
- end
- ------------------------------------------------------------------------
- -- * l1 was a pointer, now l1 is returned and callee assigns the value
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:concat(fs, l1, l2)
- if l2 == self.NO_JUMP then return l1
- elseif l1 == self.NO_JUMP then
- return l2
- else
- local list = l1
- local _next = self:getjump(fs, list)
- while _next ~= self.NO_JUMP do -- find last element
- list = _next
- _next = self:getjump(fs, list)
- end
- self:fixjump(fs, list, l2)
- end
- return l1
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:reserveregs(), (lparser) luaY:forlist()
- ------------------------------------------------------------------------
- function luaK:checkstack(fs, n)
- local newstack = fs.freereg + n
- if newstack > fs.f.maxstacksize then
- if newstack >= self.MAXSTACK then
- luaX:syntaxerror(fs.ls, "function or expression too complex")
- end
- fs.f.maxstacksize = newstack
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:reserveregs(fs, n)
- self:checkstack(fs, n)
- fs.freereg = fs.freereg + n
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:freeexp(), luaK:dischargevars()
- ------------------------------------------------------------------------
- function luaK:freereg(fs, reg)
- if not luaP:ISK(reg) and reg >= fs.nactvar then
- fs.freereg = fs.freereg - 1
- assert(reg == fs.freereg)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:freeexp(fs, e)
- if e.k == "VNONRELOC" then
- self:freereg(fs, e.info)
- end
- end
- ------------------------------------------------------------------------
- -- * TODO NOTE implementation is not 100% correct, since the assert fails
- -- * luaH_set, setobj deleted; direct table access used instead
- -- * used in luaK:stringK(), luaK:numberK(), luaK:boolK(), luaK:nilK()
- ------------------------------------------------------------------------
- function luaK:addk(fs, k, v)
- local L = fs.L
- local idx = fs.h[k.value]
- --TValue *idx = luaH_set(L, fs->h, k); /* C */
- local f = fs.f
- if self:ttisnumber(idx) then
- --TODO this assert currently FAILS (last tested for 5.0.2)
- --assert(fs.f.k[self:nvalue(idx)] == v)
- --assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); /* C */
- return self:nvalue(idx)
- else -- constant not found; create a new entry
- idx = {}
- self:setnvalue(idx, fs.nk)
- fs.h[k.value] = idx
- -- setnvalue(idx, cast_num(fs->nk)); /* C */
- luaY:growvector(L, f.k, fs.nk, f.sizek, nil,
- luaP.MAXARG_Bx, "constant table overflow")
- -- loop to initialize empty f.k positions not required
- f.k[fs.nk] = v
- -- setobj(L, &f->k[fs->nk], v); /* C */
- -- luaC_barrier(L, f, v); /* GC */
- local nk = fs.nk
- fs.nk = fs.nk + 1
- return nk
- end
- end
- ------------------------------------------------------------------------
- -- creates and sets a string object
- -- * used in (lparser) luaY:codestring(), luaY:singlevar()
- ------------------------------------------------------------------------
- function luaK:stringK(fs, s)
- local o = {} -- TValue
- self:setsvalue(o, s)
- return self:addk(fs, o, o)
- end
- ------------------------------------------------------------------------
- -- creates and sets a number object
- -- * used in luaK:prefix() for negative (or negation of) numbers
- -- * used in (lparser) luaY:simpleexp(), luaY:fornum()
- ------------------------------------------------------------------------
- function luaK:numberK(fs, r)
- local o = {} -- TValue
- self:setnvalue(o, r)
- return self:addk(fs, o, o)
- end
- ------------------------------------------------------------------------
- -- creates and sets a boolean object
- -- * used only in luaK:exp2RK()
- ------------------------------------------------------------------------
- function luaK:boolK(fs, b)
- local o = {} -- TValue
- self:setbvalue(o, b)
- return self:addk(fs, o, o)
- end
- ------------------------------------------------------------------------
- -- creates and sets a nil object
- -- * used only in luaK:exp2RK()
- ------------------------------------------------------------------------
- function luaK:nilK(fs)
- local k, v = {}, {} -- TValue
- self:setnilvalue(v)
- -- cannot use nil as key; instead use table itself to represent nil
- self:sethvalue(k, fs.h)
- return self:addk(fs, k, v)
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:setmultret(), (lparser) luaY:adjust_assign()
- ------------------------------------------------------------------------
- function luaK:setreturns(fs, e, nresults)
- if e.k == "VCALL" then -- expression is an open function call?
- luaP:SETARG_C(self:getcode(fs, e), nresults + 1)
- elseif e.k == "VVARARG" then
- luaP:SETARG_B(self:getcode(fs, e), nresults + 1);
- luaP:SETARG_A(self:getcode(fs, e), fs.freereg);
- luaK:reserveregs(fs, 1)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:dischargevars(), (lparser) luaY:assignment()
- ------------------------------------------------------------------------
- function luaK:setoneret(fs, e)
- if e.k == "VCALL" then -- expression is an open function call?
- e.k = "VNONRELOC"
- e.info = luaP:GETARG_A(self:getcode(fs, e))
- elseif e.k == "VVARARG" then
- luaP:SETARG_B(self:getcode(fs, e), 2)
- e.k = "VRELOCABLE" -- can relocate its simple result
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:dischargevars(fs, e)
- local k = e.k
- if k == "VLOCAL" then
- e.k = "VNONRELOC"
- elseif k == "VUPVAL" then
- e.info = self:codeABC(fs, "OP_GETUPVAL", 0, e.info, 0)
- e.k = "VRELOCABLE"
- elseif k == "VGLOBAL" then
- e.info = self:codeABx(fs, "OP_GETGLOBAL", 0, e.info)
- e.k = "VRELOCABLE"
- elseif k == "VINDEXED" then
- self:freereg(fs, e.aux)
- self:freereg(fs, e.info)
- e.info = self:codeABC(fs, "OP_GETTABLE", 0, e.info, e.aux)
- e.k = "VRELOCABLE"
- elseif k == "VVARARG" or k == "VCALL" then
- self:setoneret(fs, e)
- else
- -- there is one value available (somewhere)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used only in luaK:exp2reg()
- ------------------------------------------------------------------------
- function luaK:code_label(fs, A, b, jump)
- self:getlabel(fs) -- those instructions may be jump targets
- return self:codeABC(fs, "OP_LOADBOOL", A, b, jump)
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:discharge2anyreg(), luaK:exp2reg()
- ------------------------------------------------------------------------
- function luaK:discharge2reg(fs, e, reg)
- self:dischargevars(fs, e)
- local k = e.k
- if k == "VNIL" then
- self:_nil(fs, reg, 1)
- elseif k == "VFALSE" or k == "VTRUE" then
- self:codeABC(fs, "OP_LOADBOOL", reg, (e.k == "VTRUE") and 1 or 0, 0)
- elseif k == "VK" then
- self:codeABx(fs, "OP_LOADK", reg, e.info)
- elseif k == "VKNUM" then
- self:codeABx(fs, "OP_LOADK", reg, self:numberK(fs, e.nval))
- elseif k == "VRELOCABLE" then
- local pc = self:getcode(fs, e)
- luaP:SETARG_A(pc, reg)
- elseif k == "VNONRELOC" then
- if reg ~= e.info then
- self:codeABC(fs, "OP_MOVE", reg, e.info, 0)
- end
- else
- assert(e.k == "VVOID" or e.k == "VJMP")
- return -- nothing to do...
- end
- e.info = reg
- e.k = "VNONRELOC"
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:jumponcond(), luaK:codenot()
- ------------------------------------------------------------------------
- function luaK:discharge2anyreg(fs, e)
- if e.k ~= "VNONRELOC" then
- self:reserveregs(fs, 1)
- self:discharge2reg(fs, e, fs.freereg - 1)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:exp2nextreg(), luaK:exp2anyreg(), luaK:storevar()
- ------------------------------------------------------------------------
- function luaK:exp2reg(fs, e, reg)
- self:discharge2reg(fs, e, reg)
- if e.k == "VJMP" then
- e.t = self:concat(fs, e.t, e.info) -- put this jump in 't' list
- end
- if self:hasjumps(e) then
- local final -- position after whole expression
- local p_f = self.NO_JUMP -- position of an eventual LOAD false
- local p_t = self.NO_JUMP -- position of an eventual LOAD true
- if self:need_value(fs, e.t) or self:need_value(fs, e.f) then
- local fj = (e.k == "VJMP") and self.NO_JUMP or self:jump(fs)
- p_f = self:code_label(fs, reg, 0, 1)
- p_t = self:code_label(fs, reg, 1, 0)
- self:patchtohere(fs, fj)
- end
- final = self:getlabel(fs)
- self:patchlistaux(fs, e.f, final, reg, p_f)
- self:patchlistaux(fs, e.t, final, reg, p_t)
- end
- e.f, e.t = self.NO_JUMP, self.NO_JUMP
- e.info = reg
- e.k = "VNONRELOC"
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:exp2nextreg(fs, e)
- self:dischargevars(fs, e)
- self:freeexp(fs, e)
- self:reserveregs(fs, 1)
- self:exp2reg(fs, e, fs.freereg - 1)
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:exp2anyreg(fs, e)
- self:dischargevars(fs, e)
- if e.k == "VNONRELOC" then
- if not self:hasjumps(e) then -- exp is already in a register
- return e.info
- end
- if e.info >= fs.nactvar then -- reg. is not a local?
- self:exp2reg(fs, e, e.info) -- put value on it
- return e.info
- end
- end
- self:exp2nextreg(fs, e) -- default
- return e.info
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:exp2RK(), luaK:prefix(), luaK:posfix()
- -- * used in (lparser) luaY:yindex()
- ------------------------------------------------------------------------
- function luaK:exp2val(fs, e)
- if self:hasjumps(e) then
- self:exp2anyreg(fs, e)
- else
- self:dischargevars(fs, e)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used in multiple locations
- ------------------------------------------------------------------------
- function luaK:exp2RK(fs, e)
- self:exp2val(fs, e)
- local k = e.k
- if k == "VKNUM" or k == "VTRUE" or k == "VFALSE" or k == "VNIL" then
- if fs.nk <= luaP.MAXINDEXRK then -- constant fit in RK operand?
- -- converted from a 2-deep ternary operator expression
- if e.k == "VNIL" then
- e.info = self:nilK(fs)
- else
- e.info = (e.k == "VKNUM") and self:numberK(fs, e.nval)
- or self:boolK(fs, e.k == "VTRUE")
- end
- e.k = "VK"
- return luaP:RKASK(e.info)
- end
- elseif k == "VK" then
- if e.info <= luaP.MAXINDEXRK then -- constant fit in argC?
- return luaP:RKASK(e.info)
- end
- else
- -- default
- end
- -- not a constant in the right range: put it in a register
- return self:exp2anyreg(fs, e)
- end
- ------------------------------------------------------------------------
- --
- -- * used in (lparser) luaY:assignment(), luaY:localfunc(), luaY:funcstat()
- ------------------------------------------------------------------------
- function luaK:storevar(fs, var, ex)
- local k = var.k
- if k == "VLOCAL" then
- self:freeexp(fs, ex)
- self:exp2reg(fs, ex, var.info)
- return
- elseif k == "VUPVAL" then
- local e = self:exp2anyreg(fs, ex)
- self:codeABC(fs, "OP_SETUPVAL", e, var.info, 0)
- elseif k == "VGLOBAL" then
- local e = self:exp2anyreg(fs, ex)
- self:codeABx(fs, "OP_SETGLOBAL", e, var.info)
- elseif k == "VINDEXED" then
- local e = self:exp2RK(fs, ex)
- self:codeABC(fs, "OP_SETTABLE", var.info, var.aux, e)
- else
- assert(0) -- invalid var kind to store
- end
- self:freeexp(fs, ex)
- end
- ------------------------------------------------------------------------
- --
- -- * used only in (lparser) luaY:primaryexp()
- ------------------------------------------------------------------------
- function luaK:_self(fs, e, key)
- self:exp2anyreg(fs, e)
- self:freeexp(fs, e)
- local func = fs.freereg
- self:reserveregs(fs, 2)
- self:codeABC(fs, "OP_SELF", func, e.info, self:exp2RK(fs, key))
- self:freeexp(fs, key)
- e.info = func
- e.k = "VNONRELOC"
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:goiftrue(), luaK:codenot()
- ------------------------------------------------------------------------
- function luaK:invertjump(fs, e)
- local pc = self:getjumpcontrol(fs, e.info)
- assert(luaP:testTMode(luaP:GET_OPCODE(pc)) ~= 0 and
- luaP:GET_OPCODE(pc) ~= "OP_TESTSET" and
- luaP:GET_OPCODE(pc) ~= "OP_TEST")
- luaP:SETARG_A(pc, (luaP:GETARG_A(pc) == 0) and 1 or 0)
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:goiftrue(), luaK:goiffalse()
- ------------------------------------------------------------------------
- function luaK:jumponcond(fs, e, cond)
- if e.k == "VRELOCABLE" then
- local ie = self:getcode(fs, e)
- if luaP:GET_OPCODE(ie) == "OP_NOT" then
- fs.pc = fs.pc - 1 -- remove previous OP_NOT
- return self:condjump(fs, "OP_TEST", luaP:GETARG_B(ie), 0, cond and 0 or 1)
- end
- -- else go through
- end
- self:discharge2anyreg(fs, e)
- self:freeexp(fs, e)
- return self:condjump(fs, "OP_TESTSET", luaP.NO_REG, e.info, cond and 1 or 0)
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:infix(), (lparser) luaY:cond()
- ------------------------------------------------------------------------
- function luaK:goiftrue(fs, e)
- local pc -- pc of last jump
- self:dischargevars(fs, e)
- local k = e.k
- if k == "VK" or k == "VKNUM" or k == "VTRUE" then
- pc = self.NO_JUMP -- always true; do nothing
- elseif k == "VFALSE" then
- pc = self:jump(fs) -- always jump
- elseif k == "VJMP" then
- self:invertjump(fs, e)
- pc = e.info
- else
- pc = self:jumponcond(fs, e, false)
- end
- e.f = self:concat(fs, e.f, pc) -- insert last jump in `f' list
- self:patchtohere(fs, e.t)
- e.t = self.NO_JUMP
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:infix()
- ------------------------------------------------------------------------
- function luaK:goiffalse(fs, e)
- local pc -- pc of last jump
- self:dischargevars(fs, e)
- local k = e.k
- if k == "VNIL" or k == "VFALSE"then
- pc = self.NO_JUMP -- always false; do nothing
- elseif k == "VTRUE" then
- pc = self:jump(fs) -- always jump
- elseif k == "VJMP" then
- pc = e.info
- else
- pc = self:jumponcond(fs, e, true)
- end
- e.t = self:concat(fs, e.t, pc) -- insert last jump in `t' list
- self:patchtohere(fs, e.f)
- e.f = self.NO_JUMP
- end
- ------------------------------------------------------------------------
- --
- -- * used only in luaK:prefix()
- ------------------------------------------------------------------------
- function luaK:codenot(fs, e)
- self:dischargevars(fs, e)
- local k = e.k
- if k == "VNIL" or k == "VFALSE" then
- e.k = "VTRUE"
- elseif k == "VK" or k == "VKNUM" or k == "VTRUE" then
- e.k = "VFALSE"
- elseif k == "VJMP" then
- self:invertjump(fs, e)
- elseif k == "VRELOCABLE" or k == "VNONRELOC" then
- self:discharge2anyreg(fs, e)
- self:freeexp(fs, e)
- e.info = self:codeABC(fs, "OP_NOT", 0, e.info, 0)
- e.k = "VRELOCABLE"
- else
- assert(0) -- cannot happen
- end
- -- interchange true and false lists
- e.f, e.t = e.t, e.f
- self:removevalues(fs, e.f)
- self:removevalues(fs, e.t)
- end
- ------------------------------------------------------------------------
- --
- -- * used in (lparser) luaY:field(), luaY:primaryexp()
- ------------------------------------------------------------------------
- function luaK:indexed(fs, t, k)
- t.aux = self:exp2RK(fs, k)
- t.k = "VINDEXED"
- end
- ------------------------------------------------------------------------
- --
- -- * used only in luaK:codearith()
- ------------------------------------------------------------------------
- function luaK:constfolding(op, e1, e2)
- local r
- if not self:isnumeral(e1) or not self:isnumeral(e2) then return false end
- local v1 = e1.nval
- local v2 = e2.nval
- if op == "OP_ADD" then
- r = self:numadd(v1, v2)
- elseif op == "OP_SUB" then
- r = self:numsub(v1, v2)
- elseif op == "OP_MUL" then
- r = self:nummul(v1, v2)
- elseif op == "OP_DIV" then
- if v2 == 0 then return false end -- do not attempt to divide by 0
- r = self:numdiv(v1, v2)
- elseif op == "OP_MOD" then
- if v2 == 0 then return false end -- do not attempt to divide by 0
- r = self:nummod(v1, v2)
- elseif op == "OP_POW" then
- r = self:numpow(v1, v2)
- elseif op == "OP_UNM" then
- r = self:numunm(v1)
- elseif op == "OP_LEN" then
- return false -- no constant folding for 'len'
- else
- assert(0)
- r = 0
- end
- if self:numisnan(r) then return false end -- do not attempt to produce NaN
- e1.nval = r
- return true
- end
- ------------------------------------------------------------------------
- --
- -- * used in luaK:prefix(), luaK:posfix()
- ------------------------------------------------------------------------
- function luaK:codearith(fs, op, e1, e2)
- if self:constfolding(op, e1, e2) then
- return
- else
- local o2 = (op ~= "OP_UNM" and op ~= "OP_LEN") and self:exp2RK(fs, e2) or 0
- local o1 = self:exp2RK(fs, e1)
- if o1 > o2 then
- self:freeexp(fs, e1)
- self:freeexp(fs, e2)
- else
- self:freeexp(fs, e2)
- self:freeexp(fs, e1)
- end
- e1.info = self:codeABC(fs, op, 0, o1, o2)
- e1.k = "VRELOCABLE"
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used only in luaK:posfix()
- ------------------------------------------------------------------------
- function luaK:codecomp(fs, op, cond, e1, e2)
- local o1 = self:exp2RK(fs, e1)
- local o2 = self:exp2RK(fs, e2)
- self:freeexp(fs, e2)
- self:freeexp(fs, e1)
- if cond == 0 and op ~= "OP_EQ" then
- -- exchange args to replace by `<' or `<='
- o1, o2 = o2, o1 -- o1 <==> o2
- cond = 1
- end
- e1.info = self:condjump(fs, op, cond, o1, o2)
- e1.k = "VJMP"
- end
- ------------------------------------------------------------------------
- --
- -- * used only in (lparser) luaY:subexpr()
- ------------------------------------------------------------------------
- function luaK:prefix(fs, op, e)
- local e2 = {} -- expdesc
- e2.t, e2.f = self.NO_JUMP, self.NO_JUMP
- e2.k = "VKNUM"
- e2.nval = 0
- if op == "OPR_MINUS" then
- if not self:isnumeral(e) then
- self:exp2anyreg(fs, e) -- cannot operate on non-numeric constants
- end
- self:codearith(fs, "OP_UNM", e, e2)
- elseif op == "OPR_NOT" then
- self:codenot(fs, e)
- elseif op == "OPR_LEN" then
- self:exp2anyreg(fs, e) -- cannot operate on constants
- self:codearith(fs, "OP_LEN", e, e2)
- else
- assert(0)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used only in (lparser) luaY:subexpr()
- ------------------------------------------------------------------------
- function luaK:infix(fs, op, v)
- if op == "OPR_AND" then
- self:goiftrue(fs, v)
- elseif op == "OPR_OR" then
- self:goiffalse(fs, v)
- elseif op == "OPR_CONCAT" then
- self:exp2nextreg(fs, v) -- operand must be on the 'stack'
- elseif op == "OPR_ADD" or op == "OPR_SUB" or
- op == "OPR_MUL" or op == "OPR_DIV" or
- op == "OPR_MOD" or op == "OPR_POW" then
- if not self:isnumeral(v) then self:exp2RK(fs, v) end
- else
- self:exp2RK(fs, v)
- end
- end
- ------------------------------------------------------------------------
- --
- -- * used only in (lparser) luaY:subexpr()
- ------------------------------------------------------------------------
- -- table lookups to simplify testing
- luaK.arith_op = {
- OPR_ADD = "OP_ADD", OPR_SUB = "OP_SUB", OPR_MUL = "OP_MUL",
- OPR_DIV = "OP_DIV", OPR_MOD = "OP_MOD", OPR_POW = "OP_POW",
- }
- luaK.comp_op = {
- OPR_EQ = "OP_EQ", OPR_NE = "OP_EQ", OPR_LT = "OP_LT",
- OPR_LE = "OP_LE", OPR_GT = "OP_LT", OPR_GE = "OP_LE",
- }
- luaK.comp_cond = {
- OPR_EQ = 1, OPR_NE = 0, OPR_LT = 1,
- OPR_LE = 1, OPR_GT = 0, OPR_GE = 0,
- }
- function luaK:posfix(fs, op, e1, e2)
- -- needed because e1 = e2 doesn't copy values...
- -- * in 5.0.x, only k/info/aux/t/f copied, t for AND, f for OR
- -- but here, all elements are copied for completeness' sake
- local function copyexp(e1, e2)
- e1.k = e2.k
- e1.info = e2.info; e1.aux = e2.aux
- e1.nval = e2.nval
- e1.t = e2.t; e1.f = e2.f
- end
- if op == "OPR_AND" then
- assert(e1.t == self.NO_JUMP) -- list must be closed
- self:dischargevars(fs, e2)
- e2.f = self:concat(fs, e2.f, e1.f)
- copyexp(e1, e2)
- elseif op == "OPR_OR" then
- assert(e1.f == self.NO_JUMP) -- list must be closed
- self:dischargevars(fs, e2)
- e2.t = self:concat(fs, e2.t, e1.t)
- copyexp(e1, e2)
- elseif op == "OPR_CONCAT" then
- self:exp2val(fs, e2)
- if e2.k == "VRELOCABLE" and luaP:GET_OPCODE(self:getcode(fs, e2)) == "OP_CONCAT" then
- assert(e1.info == luaP:GETARG_B(self:getcode(fs, e2)) - 1)
- self:freeexp(fs, e1)
- luaP:SETARG_B(self:getcode(fs, e2), e1.info)
- e1.k = "VRELOCABLE"
- e1.info = e2.info
- else
- self:exp2nextreg(fs, e2) -- operand must be on the 'stack'
- self:codearith(fs, "OP_CONCAT", e1, e2)
- end
- else
- -- the following uses a table lookup in place of conditionals
- local arith = self.arith_op[op]
- if arith then
- self:codearith(fs, arith, e1, e2)
- else
- local comp = self.comp_op[op]
- if comp then
- self:codecomp(fs, comp, self.comp_cond[op], e1, e2)
- else
- assert(0)
- end
- end--if arith
- end--if op
- end
- ------------------------------------------------------------------------
- -- adjusts debug information for last instruction written, in order to
- -- change the line where item comes into existence
- -- * used in (lparser) luaY:funcargs(), luaY:forbody(), luaY:funcstat()
- ------------------------------------------------------------------------
- function luaK:fixline(fs, line)
- fs.f.lineinfo[fs.pc - 1] = line
- end
- ------------------------------------------------------------------------
- -- general function to write an instruction into the instruction buffer,
- -- sets debug information too
- -- * used in luaK:codeABC(), luaK:codeABx()
- -- * called directly by (lparser) luaY:whilestat()
- ------------------------------------------------------------------------
- function luaK:code(fs, i, line)
- local f = fs.f
- self:dischargejpc(fs) -- 'pc' will change
- -- put new instruction in code array
- luaY:growvector(fs.L, f.code, fs.pc, f.sizecode, nil,
- luaY.MAX_INT, "code size overflow")
- f.code[fs.pc] = i
- -- save corresponding line information
- luaY:growvector(fs.L, f.lineinfo, fs.pc, f.sizelineinfo, nil,
- luaY.MAX_INT, "code size overflow")
- f.lineinfo[fs.pc] = line
- local pc = fs.pc
- fs.pc = fs.pc + 1
- return pc
- end
- ------------------------------------------------------------------------
- -- writes an instruction of type ABC
- -- * calls luaK:code()
- ------------------------------------------------------------------------
- function luaK:codeABC(fs, o, a, b, c)
- assert(luaP:getOpMode(o) == luaP.OpMode.iABC)
- assert(luaP:getBMode(o) ~= luaP.OpArgMask.OpArgN or b == 0)
- assert(luaP:getCMode(o) ~= luaP.OpArgMask.OpArgN or c == 0)
- return self:code(fs, luaP:CREATE_ABC(o, a, b, c), fs.ls.lastline)
- end
- ------------------------------------------------------------------------
- -- writes an instruction of type ABx
- -- * calls luaK:code(), called by luaK:codeAsBx()
- ------------------------------------------------------------------------
- function luaK:codeABx(fs, o, a, bc)
- assert(luaP:getOpMode(o) == luaP.OpMode.iABx or
- luaP:getOpMode(o) == luaP.OpMode.iAsBx)
- assert(luaP:getCMode(o) == luaP.OpArgMask.OpArgN)
- return self:code(fs, luaP:CREATE_ABx(o, a, bc), fs.ls.lastline)
- end
- ------------------------------------------------------------------------
- --
- -- * used in (lparser) luaY:closelistfield(), luaY:lastlistfield()
- ------------------------------------------------------------------------
- function luaK:setlist(fs, base, nelems, tostore)
- local c = math.floor((nelems - 1)/luaP.LFIELDS_PER_FLUSH) + 1
- local b = (tostore == luaY.LUA_MULTRET) and 0 or tostore
- assert(tostore ~= 0)
- if c <= luaP.MAXARG_C then
- self:codeABC(fs, "OP_SETLIST", base, b, c)
- else
- self:codeABC(fs, "OP_SETLIST", base, b, 0)
- self:code(fs, luaP:CREATE_Inst(c), fs.ls.lastline)
- end
- fs.freereg = base + 1 -- free registers with list values
- end
- return function(a) luaY = a return luaK end]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX82A08A032D8747CFA198FEA2A95DD5E2">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">LuaU</string>
- <string name="ScriptGuid">{21232045-4BF5-4A9E-A6DA-AC03A546A2E7}</string>
- <ProtectedString name="Source"><![CDATA[local type = type;
- local table = table;
- local string = string;
- local error = error;
- local debug = debug;
- local require = require;
- local version = version;
- local math = math;
- local assert = assert;
- --[[--------------------------------------------------------------------
- ldump.lua
- Save precompiled Lua chunks
- This file is part of Yueliang.
- Copyright (c) 2006 Kein-Hong Man <khman@users.sf.net>
- The COPYRIGHT file describes the conditions
- under which this software may be distributed.
- See the ChangeLog for more information.
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- Notes:
- -- * WARNING! byte order (little endian) and data type sizes for header
- -- signature values hard-coded; see luaU:header
- -- * chunk writer generators are included, see below
- -- * one significant difference is that instructions are still in table
- -- form (with OP/A/B/C/Bx fields) and luaP:Instruction() is needed to
- -- convert them into 4-char strings
- --
- -- Not implemented:
- -- * DumpVar, DumpMem has been removed
- -- * DumpVector folded into folded into DumpDebug, DumpCode
- --
- -- Added:
- -- * for convenience, the following two functions have been added:
- -- luaU:make_setS: create a chunk writer that writes to a string
- -- luaU:make_setF: create a chunk writer that writes to a file
- -- (lua.h contains a typedef for lua_Writer/lua_Chunkwriter, and
- -- a Lua-based implementation exists, writer() in lstrlib.c)
- -- * luaU:ttype(o) (from lobject.h)
- -- * for converting number types to its binary equivalent:
- -- luaU:from_double(x): encode double value for writing
- -- luaU:from_int(x): encode integer value for writing
- -- (error checking is limited for these conversion functions)
- -- (double conversion does not support denormals or NaNs)
- --
- -- Changed in 5.1.x:
- -- * the dumper was mostly rewritten in Lua 5.1.x, so notes on the
- -- differences between 5.0.x and 5.1.x is limited
- -- * LUAC_VERSION bumped to 0x51, LUAC_FORMAT added
- -- * developer is expected to adjust LUAC_FORMAT in order to identify
- -- non-standard binary chunk formats
- -- * header signature code is smaller, has been simplified, and is
- -- tested as a single unit; its logic is shared with the undumper
- -- * no more endian conversion, invalid endianness mean rejection
- -- * opcode field sizes are no longer exposed in the header
- -- * code moved to front of a prototype, followed by constants
- -- * debug information moved to the end of the binary chunk, and the
- -- relevant functions folded into a single function
- -- * luaU:dump returns a writer status code
- -- * chunk writer now implements status code because dumper uses it
- -- * luaU:endianness removed
- ----------------------------------------------------------------------]]
- --requires luaP
- local luaU = {}
- local luaP = require(script.Parent.LuaP)
- -- mark for precompiled code ('<esc>Lua') (from lua.h)
- luaU.LUA_SIGNATURE = "\27Lua"
- -- constants used by dumper (from lua.h)
- luaU.LUA_TNUMBER = 3
- luaU.LUA_TSTRING = 4
- luaU.LUA_TNIL = 0
- luaU.LUA_TBOOLEAN = 1
- luaU.LUA_TNONE = -1
- -- constants for header of binary files (from lundump.h)
- luaU.LUAC_VERSION = 0x51 -- this is Lua 5.1
- luaU.LUAC_FORMAT = 0 -- this is the official format
- luaU.LUAC_HEADERSIZE = 12 -- size of header of binary files
- --[[--------------------------------------------------------------------
- -- Additional functions to handle chunk writing
- -- * to use make_setS and make_setF, see test_ldump.lua elsewhere
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- create a chunk writer that writes to a string
- -- * returns the writer function and a table containing the string
- -- * to get the final result, look in buff.data
- ------------------------------------------------------------------------
- function luaU:make_setS()
- local buff = {}
- buff.data = ""
- local writer =
- function(s, buff) -- chunk writer
- if not s then return 0 end
- buff.data = buff.data..s
- return 0
- end
- return writer, buff
- end
- ------------------------------------------------------------------------
- -- create a chunk writer that writes to a file
- -- * returns the writer function and a table containing the file handle
- -- * if a nil is passed, then writer should close the open file
- ------------------------------------------------------------------------
- --[[
- function luaU:make_setF(filename)
- local buff = {}
- buff.h = io.open(filename, "wb")
- if not buff.h then return nil end
- local writer =
- function(s, buff) -- chunk writer
- if not buff.h then return 0 end
- if not s then
- if buff.h:close() then return 0 end
- else
- if buff.h:write(s) then return 0 end
- end
- return 1
- end
- return writer, buff
- end--]]
- ------------------------------------------------------------------------
- -- works like the lobject.h version except that TObject used in these
- -- scripts only has a 'value' field, no 'tt' field (native types used)
- ------------------------------------------------------------------------
- function luaU:ttype(o)
- local tt = type(o.value)
- if tt == "number" then return self.LUA_TNUMBER
- elseif tt == "string" then return self.LUA_TSTRING
- elseif tt == "nil" then return self.LUA_TNIL
- elseif tt == "boolean" then return self.LUA_TBOOLEAN
- else
- return self.LUA_TNONE -- the rest should not appear
- end
- end
- -----------------------------------------------------------------------
- -- converts a IEEE754 double number to an 8-byte little-endian string
- -- * luaU:from_double() and luaU:from_int() are adapted from ChunkBake
- -- * supports +/- Infinity, but not denormals or NaNs
- -----------------------------------------------------------------------
- function luaU:from_double(x)
- local function grab_byte(v)
- local c = v % 256
- return (v - c) / 256, string.char(c)
- end
- local sign = 0
- if x < 0 then sign = 1; x = -x end
- local mantissa, exponent = math.frexp(x)
- if x == 0 then -- zero
- mantissa, exponent = 0, 0
- elseif x == 1/0 then
- mantissa, exponent = 0, 2047
- else
- mantissa = (mantissa * 2 - 1) * math.ldexp(0.5, 53)
- exponent = exponent + 1022
- end
- local v, byte = "" -- convert to bytes
- x = math.floor(mantissa)
- for i = 1,6 do
- x, byte = grab_byte(x); v = v..byte -- 47:0
- end
- x, byte = grab_byte(exponent * 16 + x); v = v..byte -- 55:48
- x, byte = grab_byte(sign * 128 + x); v = v..byte -- 63:56
- return v
- end
- -----------------------------------------------------------------------
- -- converts a number to a little-endian 32-bit integer string
- -- * input value assumed to not overflow, can be signed/unsigned
- -----------------------------------------------------------------------
- function luaU:from_int(x)
- local v = ""
- x = math.floor(x)
- if x < 0 then x = 4294967296 + x end -- ULONG_MAX+1
- for i = 1, 4 do
- local c = x % 256
- v = v..string.char(c); x = math.floor(x / 256)
- end
- return v
- end
- --[[--------------------------------------------------------------------
- -- Functions to make a binary chunk
- -- * many functions have the size parameter removed, since output is
- -- in the form of a string and some sizes are implicit or hard-coded
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- struct DumpState:
- -- L -- lua_State (not used in this script)
- -- writer -- lua_Writer (chunk writer function)
- -- data -- void* (chunk writer context or data already written)
- -- strip -- if true, don't write any debug information
- -- status -- if non-zero, an error has occured
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- dumps a block of bytes
- -- * lua_unlock(D.L), lua_lock(D.L) unused
- ------------------------------------------------------------------------
- function luaU:DumpBlock(b, D)
- if D.status == 0 then
- -- lua_unlock(D->L);
- D.status = D.write(b, D.data)
- -- lua_lock(D->L);
- end
- end
- ------------------------------------------------------------------------
- -- dumps a char
- ------------------------------------------------------------------------
- function luaU:DumpChar(y, D)
- self:DumpBlock(string.char(y), D)
- end
- ------------------------------------------------------------------------
- -- dumps a 32-bit signed or unsigned integer (for int) (hard-coded)
- ------------------------------------------------------------------------
- function luaU:DumpInt(x, D)
- self:DumpBlock(self:from_int(x), D)
- end
- ------------------------------------------------------------------------
- -- dumps a lua_Number (hard-coded as a double)
- ------------------------------------------------------------------------
- function luaU:DumpNumber(x, D)
- self:DumpBlock(self:from_double(x), D)
- end
- ------------------------------------------------------------------------
- -- dumps a Lua string (size type is hard-coded)
- ------------------------------------------------------------------------
- function luaU:DumpString(s, D)
- if s == nil then
- self:DumpInt(0, D)
- else
- s = s.."\0" -- include trailing '\0'
- self:DumpInt(#s, D)
- self:DumpBlock(s, D)
- end
- end
- ------------------------------------------------------------------------
- -- dumps instruction block from function prototype
- ------------------------------------------------------------------------
- function luaU:DumpCode(f, D)
- local n = f.sizecode
- --was DumpVector
- self:DumpInt(n, D)
- for i = 0, n - 1 do
- self:DumpBlock(luaP:Instruction(f.code[i]), D)
- end
- end
- ------------------------------------------------------------------------
- -- dump constant pool from function prototype
- -- * bvalue(o), nvalue(o) and rawtsvalue(o) macros removed
- ------------------------------------------------------------------------
- function luaU:DumpConstants(f, D)
- local n = f.sizek
- self:DumpInt(n, D)
- for i = 0, n - 1 do
- local o = f.k[i] -- TValue
- local tt = self:ttype(o)
- self:DumpChar(tt, D)
- if tt == self.LUA_TNIL then
- elseif tt == self.LUA_TBOOLEAN then
- self:DumpChar(o.value and 1 or 0, D)
- elseif tt == self.LUA_TNUMBER then
- self:DumpNumber(o.value, D)
- elseif tt == self.LUA_TSTRING then
- self:DumpString(o.value, D)
- else
- --lua_assert(0) -- cannot happen
- end
- end
- n = f.sizep
- self:DumpInt(n, D)
- for i = 0, n - 1 do
- self:DumpFunction(f.p[i], f.source, D)
- end
- end
- ------------------------------------------------------------------------
- -- dump debug information
- ------------------------------------------------------------------------
- function luaU:DumpDebug(f, D)
- local n
- n = D.strip and 0 or f.sizelineinfo -- dump line information
- --was DumpVector
- self:DumpInt(n, D)
- for i = 0, n - 1 do
- self:DumpInt(f.lineinfo[i], D)
- end
- n = D.strip and 0 or f.sizelocvars -- dump local information
- self:DumpInt(n, D)
- for i = 0, n - 1 do
- self:DumpString(f.locvars[i].varname, D)
- self:DumpInt(f.locvars[i].startpc, D)
- self:DumpInt(f.locvars[i].endpc, D)
- end
- n = D.strip and 0 or f.sizeupvalues -- dump upvalue information
- self:DumpInt(n, D)
- for i = 0, n - 1 do
- self:DumpString(f.upvalues[i], D)
- end
- end
- ------------------------------------------------------------------------
- -- dump child function prototypes from function prototype
- ------------------------------------------------------------------------
- function luaU:DumpFunction(f, p, D)
- local source = f.source
- if source == p or D.strip then source = nil end
- self:DumpString(source, D)
- self:DumpInt(f.lineDefined, D)
- self:DumpInt(f.lastlinedefined, D)
- self:DumpChar(f.nups, D)
- self:DumpChar(f.numparams, D)
- self:DumpChar(f.is_vararg, D)
- self:DumpChar(f.maxstacksize, D)
- self:DumpCode(f, D)
- self:DumpConstants(f, D)
- self:DumpDebug(f, D)
- end
- ------------------------------------------------------------------------
- -- dump Lua header section (some sizes hard-coded)
- ------------------------------------------------------------------------
- function luaU:DumpHeader(D)
- local h = self:header()
- assert(#h == self.LUAC_HEADERSIZE) -- fixed buffer now an assert
- self:DumpBlock(h, D)
- end
- ------------------------------------------------------------------------
- -- make header (from lundump.c)
- -- returns the header string
- ------------------------------------------------------------------------
- function luaU:header()
- local x = 1
- return self.LUA_SIGNATURE..
- string.char(
- self.LUAC_VERSION,
- self.LUAC_FORMAT,
- x, -- endianness (1=little)
- 4, -- sizeof(int)
- 4, -- sizeof(size_t)
- 4, -- sizeof(Instruction)
- 8, -- sizeof(lua_Number)
- 0) -- is lua_Number integral?
- end
- ------------------------------------------------------------------------
- -- dump Lua function as precompiled chunk
- -- (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip)
- -- * w, data are created from make_setS, make_setF
- ------------------------------------------------------------------------
- function luaU:dump(L, f, w, data, strip)
- local D = {} -- DumpState
- D.L = L
- D.write = w
- D.data = data
- D.strip = strip
- D.status = 0
- self:DumpHeader(D)
- self:DumpFunction(f, nil, D)
- -- added: for a chunk writer writing to a file, this final call with
- -- nil data is to indicate to the writer to close the file
- D.write(nil, D.data)
- return D.status
- end
- return luaU]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX16DA520961114F59B8CFFD100AB25521">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">LuaP</string>
- <string name="ScriptGuid">{D51AF6B4-0317-406B-B194-0A76ADD86A18}</string>
- <ProtectedString name="Source"><![CDATA[local table = table;
- local string = string;
- local math = math;
- local tonumber = tonumber;
- local next = next;
- --[[--------------------------------------------------------------------
- lopcodes.lua
- Lua 5 virtual machine opcodes in Lua
- This file is part of Yueliang.
- Copyright (c) 2006 Kein-Hong Man <khman@users.sf.net>
- The COPYRIGHT file describes the conditions
- under which this software may be distributed.
- See the ChangeLog for more information.
- ----------------------------------------------------------------------]]
- --[[--------------------------------------------------------------------
- -- Notes:
- -- * an Instruction is a table with OP, A, B, C, Bx elements; this
- -- makes the code easy to follow and should allow instruction handling
- -- to work with doubles and ints
- -- * WARNING luaP:Instruction outputs instructions encoded in little-
- -- endian form and field size and positions are hard-coded
- --
- -- Not implemented:
- -- *
- --
- -- Added:
- -- * luaP:CREATE_Inst(c): create an inst from a number (for OP_SETLIST)
- -- * luaP:Instruction(i): convert field elements to a 4-char string
- -- * luaP:DecodeInst(x): convert 4-char string into field elements
- --
- -- Changed in 5.1.x:
- -- * POS_OP added, instruction field positions changed
- -- * some symbol names may have changed, e.g. LUAI_BITSINT
- -- * new operators for RK indices: BITRK, ISK(x), INDEXK(r), RKASK(x)
- -- * OP_MOD, OP_LEN is new
- -- * OP_TEST is now OP_TESTSET, OP_TEST is new
- -- * OP_FORLOOP, OP_TFORLOOP adjusted, OP_FORPREP is new
- -- * OP_TFORPREP deleted
- -- * OP_SETLIST and OP_SETLISTO merged and extended
- -- * OP_VARARG is new
- -- * many changes to implementation of OpMode data
- ----------------------------------------------------------------------]]
- local luaP = {}
- --[[
- ===========================================================================
- We assume that instructions are unsigned numbers.
- All instructions have an opcode in the first 6 bits.
- Instructions can have the following fields:
- 'A' : 8 bits
- 'B' : 9 bits
- 'C' : 9 bits
- 'Bx' : 18 bits ('B' and 'C' together)
- 'sBx' : signed Bx
- A signed argument is represented in excess K; that is, the number
- value is the unsigned value minus K. K is exactly the maximum value
- for that argument (so that -max is represented by 0, and +max is
- represented by 2*max), which is half the maximum for the corresponding
- unsigned argument.
- ===========================================================================
- --]]
- luaP.OpMode = { iABC = 0, iABx = 1, iAsBx = 2 } -- basic instruction format
- ------------------------------------------------------------------------
- -- size and position of opcode arguments.
- -- * WARNING size and position is hard-coded elsewhere in this script
- ------------------------------------------------------------------------
- luaP.SIZE_C = 9
- luaP.SIZE_B = 9
- luaP.SIZE_Bx = luaP.SIZE_C + luaP.SIZE_B
- luaP.SIZE_A = 8
- luaP.SIZE_OP = 6
- luaP.POS_OP = 0
- luaP.POS_A = luaP.POS_OP + luaP.SIZE_OP
- luaP.POS_C = luaP.POS_A + luaP.SIZE_A
- luaP.POS_B = luaP.POS_C + luaP.SIZE_C
- luaP.POS_Bx = luaP.POS_C
- ------------------------------------------------------------------------
- -- limits for opcode arguments.
- -- we use (signed) int to manipulate most arguments,
- -- so they must fit in LUAI_BITSINT-1 bits (-1 for sign)
- ------------------------------------------------------------------------
- -- removed "#if SIZE_Bx < BITS_INT-1" test, assume this script is
- -- running on a Lua VM with double or int as LUA_NUMBER
- luaP.MAXARG_Bx = math.ldexp(1, luaP.SIZE_Bx) - 1
- luaP.MAXARG_sBx = math.floor(luaP.MAXARG_Bx / 2) -- 'sBx' is signed
- luaP.MAXARG_A = math.ldexp(1, luaP.SIZE_A) - 1
- luaP.MAXARG_B = math.ldexp(1, luaP.SIZE_B) - 1
- luaP.MAXARG_C = math.ldexp(1, luaP.SIZE_C) - 1
- -- creates a mask with 'n' 1 bits at position 'p'
- -- MASK1(n,p) deleted, not required
- -- creates a mask with 'n' 0 bits at position 'p'
- -- MASK0(n,p) deleted, not required
- --[[--------------------------------------------------------------------
- Visual representation for reference:
- 31 | | | 0 bit position
- +-----+-----+-----+----------+
- | B | C | A | Opcode | iABC format
- +-----+-----+-----+----------+
- - 9 - 9 - 8 - 6 - field sizes
- +-----+-----+-----+----------+
- | [s]Bx | A | Opcode | iABx | iAsBx format
- +-----+-----+-----+----------+
- ----------------------------------------------------------------------]]
- ------------------------------------------------------------------------
- -- the following macros help to manipulate instructions
- -- * changed to a table object representation, very clean compared to
- -- the [nightmare] alternatives of using a number or a string
- -- * Bx is a separate element from B and C, since there is never a need
- -- to split Bx in the parser or code generator
- ------------------------------------------------------------------------
- -- these accept or return opcodes in the form of string names
- function luaP:GET_OPCODE(i) return self.ROpCode[i.OP] end
- function luaP:SET_OPCODE(i, o) i.OP = self.OpCode[o] end
- function luaP:GETARG_A(i) return i.A end
- function luaP:SETARG_A(i, u) i.A = u end
- function luaP:GETARG_B(i) return i.B end
- function luaP:SETARG_B(i, b) i.B = b end
- function luaP:GETARG_C(i) return i.C end
- function luaP:SETARG_C(i, b) i.C = b end
- function luaP:GETARG_Bx(i) return i.Bx end
- function luaP:SETARG_Bx(i, b) i.Bx = b end
- function luaP:GETARG_sBx(i) return i.Bx - self.MAXARG_sBx end
- function luaP:SETARG_sBx(i, b) i.Bx = b + self.MAXARG_sBx end
- function luaP:CREATE_ABC(o,a,b,c)
- return {OP = self.OpCode[o], A = a, B = b, C = c}
- end
- function luaP:CREATE_ABx(o,a,bc)
- return {OP = self.OpCode[o], A = a, Bx = bc}
- end
- ------------------------------------------------------------------------
- -- create an instruction from a number (for OP_SETLIST)
- ------------------------------------------------------------------------
- function luaP:CREATE_Inst(c)
- local o = c % 64
- c = (c - o) / 64
- local a = c % 256
- c = (c - a) / 256
- return self:CREATE_ABx(o, a, c)
- end
- ------------------------------------------------------------------------
- -- returns a 4-char string little-endian encoded form of an instruction
- ------------------------------------------------------------------------
- function luaP:Instruction(i)
- if i.Bx then
- -- change to OP/A/B/C format
- i.C = i.Bx % 512
- i.B = (i.Bx - i.C) / 512
- end
- local I = i.A * 64 + i.OP
- local c0 = I % 256
- I = i.C * 64 + (I - c0) / 256 -- 6 bits of A left
- local c1 = I % 256
- I = i.B * 128 + (I - c1) / 256 -- 7 bits of C left
- local c2 = I % 256
- local c3 = (I - c2) / 256
- return string.char(c0, c1, c2, c3)
- end
- ------------------------------------------------------------------------
- -- decodes a 4-char little-endian string into an instruction struct
- ------------------------------------------------------------------------
- function luaP:DecodeInst(x)
- local byte = string.byte
- local i = {}
- local I = byte(x, 1)
- local op = I % 64
- i.OP = op
- I = byte(x, 2) * 4 + (I - op) / 64 -- 2 bits of c0 left
- local a = I % 256
- i.A = a
- I = byte(x, 3) * 4 + (I - a) / 256 -- 2 bits of c1 left
- local c = I % 512
- i.C = c
- i.B = byte(x, 4) * 2 + (I - c) / 512 -- 1 bits of c2 left
- local opmode = self.OpMode[tonumber(string.sub(self.opmodes[op + 1], 7, 7))]
- if opmode ~= "iABC" then
- i.Bx = i.B * 512 + i.C
- end
- return i
- end
- ------------------------------------------------------------------------
- -- Macros to operate RK indices
- -- * these use arithmetic instead of bit ops
- ------------------------------------------------------------------------
- -- this bit 1 means constant (0 means register)
- luaP.BITRK = math.ldexp(1, luaP.SIZE_B - 1)
- -- test whether value is a constant
- function luaP:ISK(x) return x >= self.BITRK end
- -- gets the index of the constant
- function luaP:INDEXK(x) return x - self.BITRK end
- luaP.MAXINDEXRK = luaP.BITRK - 1
- -- code a constant index as a RK value
- function luaP:RKASK(x) return x + self.BITRK end
- ------------------------------------------------------------------------
- -- invalid register that fits in 8 bits
- ------------------------------------------------------------------------
- luaP.NO_REG = luaP.MAXARG_A
- ------------------------------------------------------------------------
- -- R(x) - register
- -- Kst(x) - constant (in constant table)
- -- RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -- grep "ORDER OP" if you change these enums
- ------------------------------------------------------------------------
- --[[--------------------------------------------------------------------
- Lua virtual machine opcodes (enum OpCode):
- ------------------------------------------------------------------------
- name args description
- ------------------------------------------------------------------------
- OP_MOVE A B R(A) := R(B)
- OP_LOADK A Bx R(A) := Kst(Bx)
- OP_LOADBOOL A B C R(A) := (Bool)B; if (C) pc++
- OP_LOADNIL A B R(A) := ... := R(B) := nil
- OP_GETUPVAL A B R(A) := UpValue[B]
- OP_GETGLOBAL A Bx R(A) := Gbl[Kst(Bx)]
- OP_GETTABLE A B C R(A) := R(B)[RK(C)]
- OP_SETGLOBAL A Bx Gbl[Kst(Bx)] := R(A)
- OP_SETUPVAL A B UpValue[B] := R(A)
- OP_SETTABLE A B C R(A)[RK(B)] := RK(C)
- OP_NEWTABLE A B C R(A) := {} (size = B,C)
- OP_SELF A B C R(A+1) := R(B); R(A) := R(B)[RK(C)]
- OP_ADD A B C R(A) := RK(B) + RK(C)
- OP_SUB A B C R(A) := RK(B) - RK(C)
- OP_MUL A B C R(A) := RK(B) * RK(C)
- OP_DIV A B C R(A) := RK(B) / RK(C)
- OP_MOD A B C R(A) := RK(B) % RK(C)
- OP_POW A B C R(A) := RK(B) ^ RK(C)
- OP_UNM A B R(A) := -R(B)
- OP_NOT A B R(A) := not R(B)
- OP_LEN A B R(A) := length of R(B)
- OP_CONCAT A B C R(A) := R(B).. ... ..R(C)
- OP_JMP sBx pc+=sBx
- OP_EQ A B C if ((RK(B) == RK(C)) ~= A) then pc++
- OP_LT A B C if ((RK(B) < RK(C)) ~= A) then pc++
- OP_LE A B C if ((RK(B) <= RK(C)) ~= A) then pc++
- OP_TEST A C if not (R(A) <=> C) then pc++
- OP_TESTSET A B C if (R(B) <=> C) then R(A) := R(B) else pc++
- OP_CALL A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))
- OP_TAILCALL A B C return R(A)(R(A+1), ... ,R(A+B-1))
- OP_RETURN A B return R(A), ... ,R(A+B-2) (see note)
- OP_FORLOOP A sBx R(A)+=R(A+2);
- if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }
- OP_FORPREP A sBx R(A)-=R(A+2); pc+=sBx
- OP_TFORLOOP A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
- if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++
- OP_SETLIST A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B
- OP_CLOSE A close all variables in the stack up to (>=) R(A)
- OP_CLOSURE A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n))
- OP_VARARG A B R(A), R(A+1), ..., R(A+B-1) = vararg
- ----------------------------------------------------------------------]]
- luaP.opnames = {} -- opcode names
- luaP.OpCode = {} -- lookup name -> number
- luaP.ROpCode = {} -- lookup number -> name
- ------------------------------------------------------------------------
- -- ORDER OP
- ------------------------------------------------------------------------
- local i = 0
- for v in string.gmatch([[
- MOVE LOADK LOADBOOL LOADNIL GETUPVAL
- GETGLOBAL GETTABLE SETGLOBAL SETUPVAL SETTABLE
- NEWTABLE SELF ADD SUB MUL
- DIV MOD POW UNM NOT
- LEN CONCAT JMP EQ LT
- LE TEST TESTSET CALL TAILCALL
- RETURN FORLOOP FORPREP TFORLOOP SETLIST
- CLOSE CLOSURE VARARG
- ]], "%S+") do
- local n = "OP_"..v
- luaP.opnames[i] = v
- luaP.OpCode[n] = i
- luaP.ROpCode[i] = n
- i = i + 1
- end
- luaP.NUM_OPCODES = i
- --[[
- ===========================================================================
- Notes:
- (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
- and can be 0: OP_CALL then sets 'top' to last_result+1, so
- next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use 'top'.
- (*) In OP_VARARG, if (B == 0) then use actual number of varargs and
- set top (like in OP_CALL with C == 0).
- (*) In OP_RETURN, if (B == 0) then return up to 'top'
- (*) In OP_SETLIST, if (B == 0) then B = 'top';
- if (C == 0) then next 'instruction' is real C
- (*) For comparisons, A specifies what condition the test should accept
- (true or false).
- (*) All 'skips' (pc++) assume that next instruction is a jump
- ===========================================================================
- --]]
- --[[--------------------------------------------------------------------
- masks for instruction properties. The format is:
- bits 0-1: op mode
- bits 2-3: C arg mode
- bits 4-5: B arg mode
- bit 6: instruction set register A
- bit 7: operator is a test
- for OpArgMask:
- OpArgN - argument is not used
- OpArgU - argument is used
- OpArgR - argument is a register or a jump offset
- OpArgK - argument is a constant or register/constant
- ----------------------------------------------------------------------]]
- -- was enum OpArgMask
- luaP.OpArgMask = { OpArgN = 0, OpArgU = 1, OpArgR = 2, OpArgK = 3 }
- ------------------------------------------------------------------------
- -- e.g. to compare with symbols, luaP:getOpMode(...) == luaP.OpCode.iABC
- -- * accepts opcode parameter as strings, e.g. "OP_MOVE"
- ------------------------------------------------------------------------
- function luaP:getOpMode(m)
- return self.opmodes[self.OpCode[m]] % 4
- end
- function luaP:getBMode(m)
- return math.floor(self.opmodes[self.OpCode[m]] / 16) % 4
- end
- function luaP:getCMode(m)
- return math.floor(self.opmodes[self.OpCode[m]] / 4) % 4
- end
- function luaP:testAMode(m)
- return math.floor(self.opmodes[self.OpCode[m]] / 64) % 2
- end
- function luaP:testTMode(m)
- return math.floor(self.opmodes[self.OpCode[m]] / 128)
- end
- -- luaP_opnames[] is set above, as the luaP.opnames table
- -- number of list items to accumulate before a SETLIST instruction
- luaP.LFIELDS_PER_FLUSH = 50
- ------------------------------------------------------------------------
- -- build instruction properties array
- -- * deliberately coded to look like the C equivalent
- ------------------------------------------------------------------------
- local function opmode(t, a, b, c, m)
- local luaP = luaP
- return t * 128 + a * 64 +
- luaP.OpArgMask[b] * 16 + luaP.OpArgMask[c] * 4 + luaP.OpMode[m]
- end
- -- ORDER OP
- luaP.opmodes = {
- -- T A B C mode opcode
- opmode(0, 1, "OpArgK", "OpArgN", "iABx"), -- OP_LOADK
- opmode(0, 1, "OpArgU", "OpArgU", "iABC"), -- OP_LOADBOOL
- opmode(0, 1, "OpArgR", "OpArgN", "iABC"), -- OP_LOADNIL
- opmode(0, 1, "OpArgU", "OpArgN", "iABC"), -- OP_GETUPVAL
- opmode(0, 1, "OpArgK", "OpArgN", "iABx"), -- OP_GETGLOBAL
- opmode(0, 1, "OpArgR", "OpArgK", "iABC"), -- OP_GETTABLE
- opmode(0, 0, "OpArgK", "OpArgN", "iABx"), -- OP_SETGLOBAL
- opmode(0, 0, "OpArgU", "OpArgN", "iABC"), -- OP_SETUPVAL
- opmode(0, 0, "OpArgK", "OpArgK", "iABC"), -- OP_SETTABLE
- opmode(0, 1, "OpArgU", "OpArgU", "iABC"), -- OP_NEWTABLE
- opmode(0, 1, "OpArgR", "OpArgK", "iABC"), -- OP_SELF
- opmode(0, 1, "OpArgK", "OpArgK", "iABC"), -- OP_ADD
- opmode(0, 1, "OpArgK", "OpArgK", "iABC"), -- OP_SUB
- opmode(0, 1, "OpArgK", "OpArgK", "iABC"), -- OP_MUL
- opmode(0, 1, "OpArgK", "OpArgK", "iABC"), -- OP_DIV
- opmode(0, 1, "OpArgK", "OpArgK", "iABC"), -- OP_MOD
- opmode(0, 1, "OpArgK", "OpArgK", "iABC"), -- OP_POW
- opmode(0, 1, "OpArgR", "OpArgN", "iABC"), -- OP_UNM
- opmode(0, 1, "OpArgR", "OpArgN", "iABC"), -- OP_NOT
- opmode(0, 1, "OpArgR", "OpArgN", "iABC"), -- OP_LEN
- opmode(0, 1, "OpArgR", "OpArgR", "iABC"), -- OP_CONCAT
- opmode(0, 0, "OpArgR", "OpArgN", "iAsBx"), -- OP_JMP
- opmode(1, 0, "OpArgK", "OpArgK", "iABC"), -- OP_EQ
- opmode(1, 0, "OpArgK", "OpArgK", "iABC"), -- OP_LT
- opmode(1, 0, "OpArgK", "OpArgK", "iABC"), -- OP_LE
- opmode(1, 1, "OpArgR", "OpArgU", "iABC"), -- OP_TEST
- opmode(1, 1, "OpArgR", "OpArgU", "iABC"), -- OP_TESTSET
- opmode(0, 1, "OpArgU", "OpArgU", "iABC"), -- OP_CALL
- opmode(0, 1, "OpArgU", "OpArgU", "iABC"), -- OP_TAILCALL
- opmode(0, 0, "OpArgU", "OpArgN", "iABC"), -- OP_RETURN
- opmode(0, 1, "OpArgR", "OpArgN", "iAsBx"), -- OP_FORLOOP
- opmode(0, 1, "OpArgR", "OpArgN", "iAsBx"), -- OP_FORPREP
- opmode(1, 0, "OpArgN", "OpArgU", "iABC"), -- OP_TFORLOOP
- opmode(0, 0, "OpArgU", "OpArgU", "iABC"), -- OP_SETLIST
- opmode(0, 0, "OpArgN", "OpArgN", "iABC"), -- OP_CLOSE
- opmode(0, 1, "OpArgU", "OpArgN", "iABx"), -- OP_CLOSURE
- opmode(0, 1, "OpArgU", "OpArgN", "iABC"), -- OP_VARARG
- }
- -- an awkward way to set a zero-indexed table...
- luaP.opmodes[0] =
- opmode(0, 1, "OpArgR", "OpArgN", "iABC") -- OP_MOVE
- return luaP]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX68094A1A110F498A83F5CEDB1F443708">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">LBI</string>
- <string name="ScriptGuid">{2BE59B0B-195F-469C-85F5-44A03A60C098}</string>
- <ProtectedString name="Source"><![CDATA[local advanced_debug
- local newEnv
- local customErrorHandler
- local debug = debug;
- local next = next;
- local string = string;
- local type = type;
- local assert = assert;
- local table = table;
- local error = error;
- local select = select;
- local unpack = unpack;
- local setmetatable = setmetatable;
- local coroutine = coroutine;
- local tostring = tostring;
- local print = print;
- local pcall = pcall;
- local getfenv = getfenv;
- local lua_opcode_types = {
- "ABC", "ABx", "ABC", "ABC",
- "ABC", "ABx", "ABC", "ABx",
- "ABC", "ABC", "ABC", "ABC",
- "ABC", "ABC", "ABC", "ABC",
- "ABC", "ABC", "ABC", "ABC",
- "ABC", "ABC", "AsBx", "ABC",
- "ABC", "ABC", "ABC", "ABC",
- "ABC", "ABC", "ABC", "AsBx",
- "AsBx", "ABC", "ABC", "ABC",
- "ABx", "ABC",
- }
- local lua_opcode_names = {
- "MOVE", "LOADK", "LOADBOOL", "LOADNIL",
- "GETUPVAL", "GETGLOBAL", "GETTABLE", "SETGLOBAL",
- "SETUPVAL", "SETTABLE", "NEWTABLE", "SELF",
- "ADD", "SUB", "MUL", "DIV",
- "MOD", "POW", "UNM", "NOT",
- "LEN", "CONCAT", "JMP", "EQ",
- "LT", "LE", "TEST", "TESTSET",
- "CALL", "TAILCALL", "RETURN", "FORLOOP",
- "FORPREP", "TFORLOOP", "SETLIST", "CLOSE",
- "CLOSURE", "VARARG"
- };
- --[[
- local lua_opcode_numbers = {};
- for number, name in next, lua_opcode_names do
- lua_opcode_numbers[name] = number;
- end
- --]]
- --- Extract bits from an integer
- --@author: Stravant
- local function get_bits(input, n, n2)
- if n2 then
- local total = 0
- local digitn = 0
- for i = n, n2 do
- total = total + 2^digitn*get_bits(input, i)
- digitn = digitn + 1
- end
- return total
- else
- local pn = 2^(n-1)
- return (input % (pn + pn) >= pn) and 1 or 0
- end
- end
- local function decode_bytecode(bytecode)
- local index = 1
- local big_endian = false
- local int_size;
- local size_t;
- -- Actual binary decoding functions. Dependant on the bytecode.
- local get_int, get_size_t;
- -- Binary decoding helper functions
- local get_int8, get_int32, get_int64, get_float64, get_string;
- do
- function get_int8()
- local a = bytecode:byte(index, index);
- index = index + 1
- return a
- end
- function get_int32()
- local a, b, c, d = bytecode:byte(index, index + 3);
- index = index + 4;
- return d*16777216 + c*65536 + b*256 + a
- end
- function get_int64()
- local a = get_int32();
- local b = get_int32();
- return b*4294967296 + a;
- end
- function get_float64()
- local a = get_int32()
- local b = get_int32()
- return (-2*get_bits(b, 32)+1)*(2^(get_bits(b, 21, 31)-1023))*
- ((get_bits(b, 1, 20)*(2^32) + a)/(2^52)+1)
- end
- function get_string(len)
- local str;
- if len then
- str = bytecode:sub(index, index + len - 1);
- index = index + len;
- else
- len = get_size_t();
- if len == 0 then return; end
- str = bytecode:sub(index, index + len - 1);
- index = index + len;
- end
- return str;
- end
- end
- local function decode_chunk()
- local chunk;
- local instructions = {};
- local constants = {};
- local prototypes = {};
- local debug = {
- lines = {};
- };
- chunk = {
- instructions = instructions;
- constants = constants;
- prototypes = prototypes;
- debug = debug;
- };
- local num;
- chunk.name = get_string();-- Function name
- chunk.first_line = get_int(); -- First line
- chunk.last_line = get_int(); -- Last line
- if chunk.name then chunk.name = chunk.name:sub(1, -2); end
- chunk.upvalues = get_int8();
- chunk.arguments = get_int8();
- chunk.varg = get_int8();
- chunk.stack = get_int8();
- -- TODO: realign lists to 1
- -- Decode instructions
- do
- num = get_int();
- for i = 1, num do
- local instruction = {
- -- opcode = opcode number;
- -- type = [ABC, ABx, AsBx]
- -- A, B, C, Bx, or sBx depending on type
- };
- local data = get_int32();
- local opcode = get_bits(data, 1, 6);
- local type = lua_opcode_types[opcode + 1];
- instruction.opcode = opcode;
- instruction.type = type;
- instruction.A = get_bits(data, 7, 14);
- if type == "ABC" then
- instruction.B = get_bits(data, 24, 32);
- instruction.C = get_bits(data, 15, 23);
- elseif type == "ABx" then
- instruction.Bx = get_bits(data, 15, 32);
- elseif type == "AsBx" then
- instruction.sBx = get_bits(data, 15, 32) - 131071;
- end
- instructions[i] = instruction;
- end
- end
- -- Decode constants
- do
- num = get_int();
- for i = 1, num do
- local constant = {
- -- type = constant type;
- -- data = constant data;
- };
- local type = get_int8();
- constant.type = type;
- if type == 1 then
- constant.data = (get_int8() ~= 0);
- elseif type == 3 then
- constant.data = get_float64();
- elseif type == 4 then
- constant.data = get_string():sub(1, -2);
- end
- constants[i-1] = constant;
- end
- end
- -- Decode Prototypes
- do
- num = get_int();
- for i = 1, num do
- prototypes[i-1] = decode_chunk();
- end
- end
- -- Decode debug info
- -- Not all of which is used yet.
- do
- -- line numbers
- local data = debug.lines
- num = get_int();
- for i = 1, num do
- data[i] = get_int32();
- end
- -- locals
- num = get_int();
- for i = 1, num do
- get_string():sub(1, -2); -- local name
- get_int32(); -- local start PC
- get_int32(); -- local end PC
- end
- -- upvalues
- num = get_int();
- for i = 1, num do
- get_string(); -- upvalue name
- end
- end
- return chunk;
- end
- -- Verify bytecode header
- do
- assert(get_string(4) == "\27Lua", "Lua bytecode expected.");
- assert(get_int8() == 0x51, "Only Lua 5.1 is supported.");
- get_int8(); -- Oficial bytecode
- big_endian = (get_int8() == 0);
- int_size = get_int8();
- size_t = get_int8();
- if int_size == 4 then
- get_int = get_int32;
- elseif int_size == 8 then
- get_int = get_int64;
- else
- -- TODO: refactor errors into table
- error("Unsupported bytecode target platform");
- end
- if size_t == 4 then
- get_size_t = get_int32;
- elseif size_t == 8 then
- get_size_t = get_int64;
- else
- error("Unsupported bytecode target platform");
- end
- assert(get_string(3) == "\4\8\0",
- "Unsupported bytecode target platform");
- end
- return decode_chunk();
- end
- local function handle_return(...)
- local c = select("#", ...)
- local t = {...}
- return c, t
- end
- local function create_wrapper(cache, upvalues)
- local instructions = cache.instructions;
- local constants = cache.constants;
- local prototypes = cache.prototypes;
- local stack, top
- local environment
- local IP = 1; -- instruction pointer
- local vararg, vararg_size
- local opcode_funcs = {
- [0] = function(instruction) -- MOVE
- stack[instruction.A] = stack[instruction.B];
- end,
- [1] = function(instruction) -- LOADK
- stack[instruction.A] = constants[instruction.Bx].data;
- end,
- [2] = function(instruction) -- LOADBOOL
- stack[instruction.A] = instruction.B ~= 0
- if instruction.C ~= 0 then
- IP = IP + 1
- end
- end,
- [3] = function(instruction) -- LOADNIL
- local stack = stack
- for i = instruction.A, instruction.B do
- stack[i] = nil
- end
- end,
- [4] = function(instruction) -- GETUPVAL
- stack[instruction.A] = upvalues[instruction.B]
- end,
- [5] = function(instruction) -- GETGLOBAL
- local key = constants[instruction.Bx].data;
- stack[instruction.A] = environment[key];
- end,
- [6] = function(instruction) -- GETTABLE
- local C = instruction.C
- local stack = stack
- C = C > 255 and constants[C-256].data or stack[C]
- stack[instruction.A] = stack[instruction.B][C];
- end,
- [7] = function(instruction) -- SETGLOBAL
- local key = constants[instruction.Bx].data;
- environment[key] = stack[instruction.A];
- end,
- [8] = function (instruction) -- SETUPVAL
- upvalues[instruction.B] = stack[instruction.A]
- end,
- [9] = function (instruction) -- SETTABLE
- local B = instruction.B;
- local C = instruction.C;
- local stack, constants = stack, constants;
- B = B > 255 and constants[B-256].data or stack[B];
- C = C > 255 and constants[C-256].data or stack[C];
- stack[instruction.A][B] = C
- end,
- [10] = function (instruction) -- NEWTABLE
- stack[instruction.A] = {}
- end,
- [11] = function (instruction) -- SELF
- local A = instruction.A
- local B = instruction.B
- local C = instruction.C
- local stack = stack
- B = stack[B]
- C = C > 255 and constants[C-256].data or stack[C]
- stack[A+1] = B
- stack[A] = B[C]
- end,
- [12] = function(instruction) -- ADD
- local B = instruction.B;
- local C = instruction.C;
- local stack, constants = stack, constants;
- B = B > 255 and constants[B-256].data or stack[B];
- C = C > 255 and constants[C-256].data or stack[C];
- stack[instruction.A] = B+C;
- end,
- [13] = function(instruction) -- SUB
- local B = instruction.B;
- local C = instruction.C;
- local stack, constants = stack, constants;
- B = B > 255 and constants[B-256].data or stack[B];
- C = C > 255 and constants[C-256].data or stack[C];
- stack[instruction.A] = B - C;
- end,
- [14] = function(instruction) -- MUL
- local B = instruction.B;
- local C = instruction.C;
- local stack, constants = stack, constants;
- B = B > 255 and constants[B-256].data or stack[B];
- C = C > 255 and constants[C-256].data or stack[C];
- stack[instruction.A] = B * C;
- end,
- [15] = function(instruction) --DIV
- local B = instruction.B;
- local C = instruction.C;
- local stack, constants = stack, constants;
- B = B > 255 and constants[B-256].data or stack[B];
- C = C > 255 and constants[C-256].data or stack[C];
- stack[instruction.A] = B / C;
- end,
- [16] = function(instruction) -- MOD
- local B = instruction.B;
- local C = instruction.C;
- local stack, constants = stack, constants;
- B = B > 255 and constants[B-256].data or stack[B];
- C = C > 255 and constants[C-256].data or stack[C];
- stack[instruction.A] = B % C;
- end,
- [17] = function(instruction) -- POW
- local B = instruction.B;
- local C = instruction.C;
- local stack, constants = stack, constants;
- B = B > 255 and constants[B-256].data or stack[B];
- C = C > 255 and constants[C-256].data or stack[C];
- stack[instruction.A] = B ^ C;
- end,
- [18] = function(instruction) -- UNM
- stack[instruction.A] = -stack[instruction.B]
- end,
- [19] = function(instruction) -- NOT
- stack[instruction.A] = not stack[instruction.B]
- end,
- [20] = function(instruction) -- LEN
- stack[instruction.A] = #stack[instruction.B]
- end,
- [21] = function(instruction) -- CONCAT
- local B = instruction.B
- local result = stack[B]
- for i = B+1, instruction.C do
- result = result .. stack[i]
- end
- stack[instruction.A] = result
- end,
- [22] = function(instruction) -- JUMP
- IP = IP + instruction.sBx
- end,
- [23] = function(instruction) -- EQ
- local A = instruction.A
- local B = instruction.B
- local C = instruction.C
- local stack, constants = stack, constants
- A = A ~= 0
- B = B > 255 and constants[B-256].data or stack[B]
- C = C > 255 and constants[C-256].data or stack[C]
- if (B == C) ~= A then
- IP = IP + 1
- end
- end,
- [24] = function(instruction) -- LT
- local A = instruction.A
- local B = instruction.B
- local C = instruction.C
- local stack, constants = stack, constants
- A = A ~= 0
- B = B > 255 and constants[B-256].data or stack[B]
- C = C > 255 and constants[C-256].data or stack[C]
- if (B < C) ~= A then
- IP = IP + 1
- end
- end,
- [25] = function(instruction) -- LT
- local A = instruction.A
- local B = instruction.B
- local C = instruction.C
- local stack, constants = stack, constants
- A = A ~= 0
- B = B > 255 and constants[B-256].data or stack[B]
- C = C > 255 and constants[C-256].data or stack[C]
- if (B <= C) ~= A then
- IP = IP + 1
- end
- end,
- [26] = function(instruction) -- TEST
- if (not not stack[instruction.A]) == (instruction.C == 0) then
- IP = IP + 1
- end
- end,
- [27] = function(instruction) -- TESTSET
- local stack = stack
- local B = stack[instruction.B]
- if (not not B) == (instruction.C == 0) then
- IP = IP + 1
- else
- stack[instruction.A] = B
- end
- end,
- [28] = function(instruction) -- CALL
- local A = instruction.A;
- local B = instruction.B;
- local C = instruction.C;
- local stack = stack;
- local args, results;
- local limit, loop
- args = {};
- if B ~= 1 then
- if B ~= 0 then
- limit = A+B-1;
- else
- limit = top
- end
- loop = 0
- for i = A+1, limit do
- loop = loop + 1
- args[loop] = stack[i];
- end
- limit, results = handle_return(stack[A](unpack(args, 1, limit-A)))
- else
- limit, results = handle_return(stack[A]())
- end
- top = A - 1
- if C ~= 1 then
- if C ~= 0 then
- limit = A+C-2;
- else
- limit = limit+A
- end
- loop = 0;
- for i = A, limit do
- loop = loop + 1;
- stack[i] = results[loop];
- end
- end
- end,
- [29] = function (instruction) -- TAILCALL
- local A = instruction.A;
- local B = instruction.B;
- local C = instruction.C;
- local stack = stack;
- local args, results;
- local top, limit, loop = top
- args = {};
- if B ~= 1 then
- if B ~= 0 then
- limit = A+B-1;
- else
- limit = top
- end
- loop = 0
- for i = A+1, limit do
- loop = loop + 1
- args[#args+1] = stack[i];
- end
- results = {stack[A](unpack(args, 1, limit-A))};
- else
- results = {stack[A]()};
- end
- return true, results
- end,
- [30] = function(instruction) -- RETURN
- --TODO: CLOSE
- local A = instruction.A;
- local B = instruction.B;
- local stack = stack;
- local limit;
- local loop, output;
- if B == 1 then
- return true;
- end
- if B == 0 then
- limit = top
- else
- limit = A + B - 2;
- end
- output = {};
- local loop = 0
- for i = A, limit do
- loop = loop + 1
- output[loop] = stack[i];
- end
- return true, output;
- end,
- [31] = function(instruction) -- FORLOOP
- local A = instruction.A
- local stack = stack
- local step = stack[A+2]
- local index = stack[A] + step
- stack[A] = index
- if step > 0 then
- if index <= stack[A+1] then
- IP = IP + instruction.sBx
- stack[A+3] = index
- end
- else
- if index >= stack[A+1] then
- IP = IP + instruction.sBx
- stack[A+3] = index
- end
- end
- end,
- [32] = function(instruction) -- FORPREP
- local A = instruction.A
- local stack = stack
- stack[A] = stack[A] - stack[A+2]
- IP = IP + instruction.sBx
- end,
- [33] = function(instruction) -- TFORLOOP
- local A = instruction.A
- local B = instruction.B
- local C = instruction.C
- local stack = stack
- local offset = A+2
- local result = {stack[A](stack[A+1], stack[A+2])}
- for i = 1, C do
- stack[offset+i] = result[i]
- end
- if stack[A+3] ~= nil then
- stack[A+2] = stack[A+3]
- else
- IP = IP + 1
- end
- end,
- [34] = function(instruction) -- SETLIST
- local A = instruction.A
- local B = instruction.B
- local C = instruction.C
- local stack = stack
- if C == 0 then
- error("NYI: extended SETLIST")
- else
- local offset = (C - 1) * 50
- local t = stack[A]
- if B == 0 then
- B = top
- end
- for i = 1, B do
- t[offset+i] = stack[A+i]
- end
- end
- end,
- [35] = function(instruction) -- CLOSE
- --io.stderr:write("NYI: CLOSE")
- --io.stderr:flush()
- end,
- [36] = function(instruction) -- CLOSURE
- local proto = prototypes[instruction.Bx]
- local instructions = instructions
- local stack = stack
- local indices = {}
- local new_upvals = setmetatable({},
- {
- __index = function(t, k)
- local upval = indices[k]
- return upval.segment[upval.offset]
- end,
- __newindex = function(t, k, v)
- local upval = indices[k]
- upval.segment[upval.offset] = v
- end
- }
- )
- for i = 1, proto.upvalues do
- local movement = instructions[IP]
- if movement.opcode == 0 then -- MOVE
- indices[i-1] = {segment = stack, offset = movement.B}
- elseif instructions[IP].opcode == 4 then -- GETUPVAL
- indices[i-1] = {segment = upvalues, offset = movement.B}
- end
- IP = IP + 1
- end
- local _, func = create_wrapper(proto, new_upvals)
- stack[instruction.A] = func
- end,
- [37] = function(instruction) -- VARARG
- local A = instruction.A
- local B = instruction.B
- local stack, vararg = stack, vararg
- for i = A, A + (B > 0 and B - 1 or vararg_size) do
- stack[i] = vararg[i - A]
- end
- end,
- }
- local function handle_error(b)
- local name = cache.name;
- local line = cache.debug.lines[IP];
- local err = (b:match("^.+:(.+)") or b)
- local output = "Error: ";
- if name then
- output = name
- end
- if line then
- output = output.." - Line: "..line
- end
- if b and type(b) == "string" then
- output = output.." - Error: ".. err
- end
- if customErrorHandler then
- --coroutine.resume(customErrorHandler,tostring(line)..":"..tostring(err))
- customErrorHandler(tostring(line)..":"..tostring(err))
- else
- error(tostring(line)..":"..tostring(err),3)
- end
- end
- local function loop()
- local instructions = instructions
- local instruction, a, b, ran
- while true do
- instruction = instructions[IP];
- --//print("IP: "..tostring(IP))
- --//print("INSTUCT: "..tostring(instruction))
- --//print("OPCODE: "..instruction.opcode)
- IP = IP + 1
- ran, a, b = pcall(function() return opcode_funcs[instruction.opcode](instruction); end);
- if not ran then
- handle_error(a);
- break;
- elseif a then
- return b;
- end
- end
- end
- local debugging = {
- get_stack = function()
- return stack;
- end;
- get_IP = function()
- return IP;
- end
- };
- local function func(...)
- local local_stack = {};
- local ghost_stack = {};
- top = -1
- stack = setmetatable(local_stack, {
- __index = ghost_stack;
- __newindex = function(t, k, v)
- if k > top and v then
- top = k
- end
- ghost_stack[k] = v
- end;
- })
- local args = {...};
- vararg = {}
- vararg_size = select("#", ...) - 1
- for i = 0, vararg_size do
- local_stack[i] = args[i+1];
- vararg[i] = args[i+1]
- end
- environment = newEnv or getfenv();
- IP = 1;
- local thread = coroutine.create(loop)
- local a, b = coroutine.resume(thread)
- if a then
- if b then
- return unpack(b);
- end
- return;
- else
- if advanced_debug then
- --TODO advanced debugging
- else
- handle_error(b)
- end
- end
- end
- return debugging, func;
- end
- return {
- load_bytecode = function(bytecode, env, customHandler)
- newEnv = env or getfenv(2)
- customErrorHandler = customHandler
- local cache = decode_bytecode(bytecode);
- local _, func = create_wrapper(cache);
- return func;
- end;
- -- Utilities (Debug, Introspection, Testing, etc)
- utils = {
- decode_bytecode = decode_bytecode;
- create_wrapper = create_wrapper;
- debug_bytecode = function(bytecode)
- local cache = decode_bytecode(bytecode)
- return create_wrapper(cache);
- end;
- };
- }]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- </Item>
- </Item>
- <Item class="Folder" referent="RBXA0A40055C7014ED99A518F2612ADA96F">
- <Properties>
- <string name="Name">3D</string>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="MeshPart" referent="RBXC5D8ED5903BE407B942C4C69E370E44C">
- <Properties>
- <bool name="Anchored">true</bool>
- <float name="BackParamA">-0.5</float>
- <float name="BackParamB">0.5</float>
- <token name="BackSurface">0</token>
- <token name="BackSurfaceInput">0</token>
- <float name="BottomParamA">-0.5</float>
- <float name="BottomParamB">0.5</float>
- <token name="BottomSurface">0</token>
- <token name="BottomSurfaceInput">0</token>
- <CoordinateFrame name="CFrame">
- <X>-5.74000788</X>
- <Y>2.02003598</Y>
- <Z>-13.9899979</Z>
- <R00>1</R00>
- <R01>0</R01>
- <R02>0</R02>
- <R10>0</R10>
- <R11>1</R11>
- <R12>0</R12>
- <R20>0</R20>
- <R21>0</R21>
- <R22>1</R22>
- </CoordinateFrame>
- <bool name="CanCollide">false</bool>
- <token name="CollisionFidelity">0</token>
- <int name="CollisionGroupId">0</int>
- <Color3uint8 name="Color3uint8">4279308561</Color3uint8>
- <PhysicalProperties name="CustomPhysicalProperties">
- <CustomPhysics>false</CustomPhysics>
- </PhysicalProperties>
- <float name="Elasticity">0.5</float>
- <float name="Friction">0.300000012</float>
- <float name="FrontParamA">-0.5</float>
- <float name="FrontParamB">0.5</float>
- <token name="FrontSurface">0</token>
- <token name="FrontSurfaceInput">0</token>
- <Vector3 name="InitialSize">
- <X>50.0000191</X>
- <Y>166.666626</Y>
- <Z>50</Z>
- </Vector3>
- <float name="LeftParamA">-0.5</float>
- <float name="LeftParamB">0.5</float>
- <token name="LeftSurface">0</token>
- <token name="LeftSurfaceInput">0</token>
- <bool name="Locked">true</bool>
- <token name="Material">288</token>
- <Content name="MeshID"><url>rbxassetid://585532343</url></Content>
- <Content name="MeshId"><url>rbxassetid://585532343</url></Content>
- <string name="Name">LowPoly</string>
- <BinaryString name="PhysicsData"><![CDATA[Q1NHUEhTAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAgD9dAAAA
- BAAAAE0RQkEDAHtC9f/HwQAAKDkAAAAAAECVt00RQsEDAHtC9f/HwU0RQsECAHtCAADIQU0R
- QkECAHtCAADIQTEzS8Fn5n1CU9XAwfDdxMFn5n1C1GYGvwe3S7+oqqZCn2YGvzEzS0Fk5n1C
- XtXAQfDdxEFn5n1CpmUGP3LBSz+oqqZC3WUGP6iqpjioqqZCW2eGP6iqpjioqqZCbmaGvwUA
- yEEDAHtCtb77PgUAyEEDAHtC5Lv7vgUAyMEDAHtC5Lv7vgUAyMEDAHtCtb77PhDvTUEDAHtC
- CxHEwTEzS0Fn5n1CU9XAwRDvTcEDAHtCCxHEwRDvTcECAHtCFBHEQTEzS8Fk5n1CXtXAQRDv
- TUECAHtCFBHEQXLBSz+oqqZCn2YGvwe3S7+oqqZC3WUGP253PsFn5n1ChQjFwW53PkFn5n1C
- hQjFwW53PsFk5n1CkAjFQW53PkFk5n1CkAjFQfDdxEFn5n1C1GYGv/DdxMFn5n1CpmUGP64A
- AAAAAAAAAQAAAAIAAAADAAAAAQAAAAQAAAAFAAAABgAAAAcAAAAIAAAACQAAAAoAAAALAAAA
- CAAAAAoAAAALAAAACgAAAAcAAAAMAAAABQAAAAcAAAAMAAAABwAAAAoAAAANAAAACQAAAAgA
- AAANAAAADgAAAAkAAAANAAAAAQAAAA4AAAAPAAAABgAAAAUAAAAPAAAAEAAAAAYAAAAPAAAA
- AQAAABAAAAARAAAAAAAAABIAAAARAAAAEgAAAA4AAAARAAAADgAAAAEAAAARAAAAAQAAAAAA
- AAATAAAAAgAAAAEAAAATAAAAAQAAAA8AAAATAAAABQAAAAIAAAATAAAADwAAAAUAAAAUAAAA
- AwAAABUAAAAUAAAAFQAAABAAAAAUAAAAEAAAAAEAAAAUAAAAAQAAAAMAAAAWAAAABAAAAAEA
- AAAWAAAAAQAAAA0AAAAWAAAACAAAAAQAAAAWAAAADQAAAAgAAAAXAAAAEgAAAAwAAAAXAAAA
- DAAAAAoAAAAXAAAACgAAAAkAAAAYAAAAFQAAAAsAAAAYAAAACwAAAAcAAAAYAAAABwAAAAYA
- AAAZAAAAAAAAAAIAAAAZAAAAAgAAAAUAAAAZAAAABQAAAAwAAAAaAAAAAAAAABkAAAAaAAAA
- GQAAAAwAAAAaAAAAEgAAAAAAAAAaAAAADAAAABIAAAAbAAAAAwAAAAQAAAAbAAAAFQAAAAMA
- AAAbAAAACwAAABUAAAAcAAAACwAAABsAAAAcAAAAGwAAAAQAAAAcAAAABAAAAAgAAAAcAAAA
- CAAAAAsAAAAdAAAACQAAAA4AAAAdAAAAFwAAAAkAAAAdAAAADgAAABIAAAAdAAAAEgAAABcA
- AAAeAAAABgAAABAAAAAeAAAAGAAAAAYAAAAeAAAAEAAAABUAAAAeAAAAFQAAABgAAAAQAAAA
- AAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAIA/XQAAAAQAAABNEUJBjP96wgAA
- yMFNEULBjP96wgAAyMEAACg5AAAAAABAlbdNEULBj/96wvX/x0FNEUJBj/96wvX/x0ExM0vB
- Duh9wl7VwMEHt0u/qKqmwmdoBr/w3cTBD+h9wi9oBr8xM0tBD+h9wlPVwEFywUs/qKqmwhZk
- Bj/w3cRBD+h9wkxkBj+oqqY4qKqmwndmhj+oqqY4qKqmwlNnhr8FAMhBj/96wgW8+z4FAMhB
- j/96wpK++74FAMjBj/96wpK++74FAMjBj/96wgW8+z4Q703Bj/96wgsRxEExM0vBD+h9wlPV
- wEEQ701Bj/96wgsRxEEQ701BjP96whQRxMExM0tBDuh9wl7VwMEQ703BjP96whQRxMFywUs/
- qKqmwmdoBr8Ht0u/qKqmwhZkBj9udz7BDuh9wpAIxcFudz5BDuh9wpAIxcFudz5BD+h9woUI
- xUFudz7BD+h9woUIxUHw3cRBD+h9wi9oBr/w3cTBD+h9wkxkBj+uAAAAAAAAAAEAAAACAAAA
- AwAAAAQAAAACAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAkAAAAIAAAACwAAAAYA
- AAAJAAAADAAAAAYAAAAFAAAADAAAAAkAAAAGAAAADQAAAAgAAAAKAAAADQAAAAoAAAAOAAAA
- DQAAAA4AAAACAAAADwAAAAUAAAAHAAAADwAAAAcAAAAQAAAADwAAABAAAAACAAAAEQAAABAA
- AAASAAAAEQAAABIAAAADAAAAEQAAAAIAAAAQAAAAEQAAAAMAAAACAAAAEwAAAAIAAAAEAAAA
- EwAAAA0AAAACAAAAEwAAAAQAAAAIAAAAEwAAAAgAAAANAAAAFAAAAA4AAAAVAAAAFAAAABUA
- AAAAAAAAFAAAAAIAAAAOAAAAFAAAAAAAAAACAAAAFgAAAAIAAAABAAAAFgAAAA8AAAACAAAA
- FgAAAAEAAAAFAAAAFgAAAAUAAAAPAAAAFwAAAAkAAAAMAAAAFwAAAAwAAAAVAAAAFwAAAAoA
- AAAJAAAAGAAAAAYAAAALAAAAGAAAAAsAAAASAAAAGAAAAAcAAAAGAAAAGQAAAAEAAAAAAAAA
- GQAAAAUAAAABAAAAGQAAAAwAAAAFAAAAGgAAAAwAAAAZAAAAGgAAABkAAAAAAAAAGgAAAAAA
- AAAVAAAAGgAAABUAAAAMAAAAGwAAAAQAAAADAAAAGwAAAAgAAAAEAAAAGwAAAAsAAAAIAAAA
- HAAAAAsAAAAbAAAAHAAAABsAAAADAAAAHAAAAAMAAAASAAAAHAAAABIAAAALAAAAHQAAAA4A
- AAAKAAAAHQAAAAoAAAAXAAAAHQAAABUAAAAOAAAAHQAAABcAAAAVAAAAHgAAABAAAAAHAAAA
- HgAAAAcAAAAYAAAAHgAAABIAAAAQAAAAHgAAABgAAAASAAAA]]></BinaryString>
- <float name="Reflectance">0</float>
- <float name="RightParamA">-0.5</float>
- <float name="RightParamB">0.5</float>
- <token name="RightSurface">0</token>
- <token name="RightSurfaceInput">0</token>
- <Vector3 name="RotVelocity">
- <X>0</X>
- <Y>0</Y>
- <Z>0</Z>
- </Vector3>
- <BinaryString name="Tags"></BinaryString>
- <Content name="TextureID"><null></null></Content>
- <float name="TopParamA">-0.5</float>
- <float name="TopParamB">0.5</float>
- <token name="TopSurface">0</token>
- <token name="TopSurfaceInput">0</token>
- <float name="Transparency">0</float>
- <Vector3 name="Velocity">
- <X>0</X>
- <Y>0</Y>
- <Z>0</Z>
- </Vector3>
- <Vector3 name="size">
- <X>1.20000005</X>
- <Y>4</Y>
- <Z>1.20000005</Z>
- </Vector3>
- </Properties>
- </Item>
- <Item class="MeshPart" referent="RBX65152941B9D04BC4960040137D86544F">
- <Properties>
- <bool name="Anchored">true</bool>
- <float name="BackParamA">-0.5</float>
- <float name="BackParamB">0.5</float>
- <token name="BackSurface">0</token>
- <token name="BackSurfaceInput">0</token>
- <float name="BottomParamA">-0.5</float>
- <float name="BottomParamB">0.5</float>
- <token name="BottomSurface">0</token>
- <token name="BottomSurfaceInput">0</token>
- <CoordinateFrame name="CFrame">
- <X>-5.74000788</X>
- <Y>2.02003598</Y>
- <Z>-11.9899979</Z>
- <R00>1</R00>
- <R01>0</R01>
- <R02>0</R02>
- <R10>0</R10>
- <R11>1</R11>
- <R12>0</R12>
- <R20>0</R20>
- <R21>0</R21>
- <R22>1</R22>
- </CoordinateFrame>
- <bool name="CanCollide">false</bool>
- <token name="CollisionFidelity">0</token>
- <int name="CollisionGroupId">0</int>
- <Color3uint8 name="Color3uint8">4279308561</Color3uint8>
- <PhysicalProperties name="CustomPhysicalProperties">
- <CustomPhysics>false</CustomPhysics>
- </PhysicalProperties>
- <float name="Elasticity">0.5</float>
- <float name="Friction">0.300000012</float>
- <float name="FrontParamA">-0.5</float>
- <float name="FrontParamB">0.5</float>
- <token name="FrontSurface">0</token>
- <token name="FrontSurfaceInput">0</token>
- <Vector3 name="InitialSize">
- <X>200</X>
- <Y>799.451721</Y>
- <Z>174.924408</Z>
- </Vector3>
- <float name="LeftParamA">-0.5</float>
- <float name="LeftParamB">0.5</float>
- <token name="LeftSurface">0</token>
- <token name="LeftSurfaceInput">0</token>
- <bool name="Locked">true</bool>
- <token name="Material">288</token>
- <Content name="MeshID"><url>rbxassetid://494629790</url></Content>
- <Content name="MeshId"><url>rbxassetid://494629790</url></Content>
- <string name="Name">MidPoly</string>
- <BinaryString name="PhysicsData"><![CDATA[Q1NHUEhTAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAgD9gAAAA
- BAAAAKL0TUINf5bDZ3yrwqL0TUIOf5ZDWnyrwgAAyEIOf5bDdBHcv6L0TcINf5ZDZ3yrQgAA
- yMIOf5ZDdBHcP6L0TcIOf5bDWnyrQty8S8Dp3MdDsEPrP9y8S0Dp3MfDsEPrv3k6S0I/PZjD
- K6aoQl4LQkINf5ZDpuyuQl4LQkIOf5bDmeyuQqp+PkI/PZhDMlOswty8S0Dp3MdDbD/rv3k6
- S0I+PZhDOKaoQgAAyEIOf5ZDdBHcP3k6S8I+PZjDOKaowty8S8Dp3MfDbD/rPwAAyMIOf5bD
- dBHcv6L0TcIOf5ZDWnyrwl4LQsINf5bDpuyuwqp+PkI+PZjDP1Oswqp+PsI/PZjDMlOsQpHc
- xMI/PZhD7j/rv6p+PsI+PZhDP1OsQpHcxEI/PZhD7j/rv5HcxMI/PZjD7j/rP6p+PsI/PZhD
- MlOswpHcxEI/PZjD7j/rP9y8S0Dp3MdDsEPrPzmFvSXp3MfDfEBrQF9qZqfp3MfDn0JrwNy8
- S8Dp3MdDbD/rv7QAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAADAAAABgAAAAQAAAAHAAAA
- AAAAAAIAAAAIAAAACQAAAAoAAAALAAAADAAAAAEAAAALAAAAAQAAAAAAAAANAAAACQAAAAgA
- AAANAAAACAAAAA4AAAAPAAAAEAAAABEAAAAPAAAAEgAAABMAAAAPAAAAEQAAABIAAAAUAAAA
- EwAAAAsAAAAUAAAACwAAAAAAAAAUAAAAAAAAAAcAAAAVAAAAAwAAAAUAAAAVAAAACgAAAAkA
- AAAVAAAABQAAABAAAAAWAAAAEgAAABEAAAAWAAAAEQAAAAQAAAAWAAAABAAAAAYAAAAXAAAA
- AwAAABUAAAAXAAAAFQAAAAkAAAAXAAAABgAAAAMAAAAYAAAAAQAAAAwAAAAYAAAAAgAAAAEA
- AAAYAAAADgAAAAIAAAAZAAAABQAAAAQAAAAZAAAABAAAABEAAAAZAAAAEAAAAAUAAAAZAAAA
- EQAAABAAAAAaAAAAEwAAABIAAAAaAAAACwAAABMAAAAaAAAADAAAAAsAAAAbAAAAAgAAAA4A
- AAAbAAAADgAAAAgAAAAbAAAABwAAAAIAAAAbAAAACAAAAAcAAAAcAAAADgAAABgAAAAcAAAA
- GAAAAAwAAAAcAAAABgAAABcAAAAcAAAAFwAAAAkAAAAcAAAADAAAAAYAAAAcAAAACQAAAA0A
- AAAcAAAADQAAAA4AAAAdAAAACgAAABUAAAAdAAAAFQAAABAAAAAdAAAAEAAAAAcAAAAdAAAA
- BwAAAAgAAAAdAAAACAAAAAoAAAAeAAAAEwAAABQAAAAeAAAAFAAAAAcAAAAeAAAABwAAABAA
- AAAeAAAAEAAAAA8AAAAeAAAADwAAABMAAAAfAAAABgAAAAwAAAAfAAAADAAAABoAAAAfAAAA
- GgAAABIAAAAfAAAAEgAAABYAAAAfAAAAFgAAAAYAAAA=]]></BinaryString>
- <float name="Reflectance">0</float>
- <float name="RightParamA">-0.5</float>
- <float name="RightParamB">0.5</float>
- <token name="RightSurface">0</token>
- <token name="RightSurfaceInput">0</token>
- <Vector3 name="RotVelocity">
- <X>0</X>
- <Y>0</Y>
- <Z>0</Z>
- </Vector3>
- <BinaryString name="Tags"></BinaryString>
- <Content name="TextureID"><null></null></Content>
- <float name="TopParamA">-0.5</float>
- <float name="TopParamB">0.5</float>
- <token name="TopSurface">0</token>
- <token name="TopSurfaceInput">0</token>
- <float name="Transparency">0</float>
- <Vector3 name="Velocity">
- <X>0</X>
- <Y>0</Y>
- <Z>0</Z>
- </Vector3>
- <Vector3 name="size">
- <X>1.20000005</X>
- <Y>4</Y>
- <Z>1.20000005</Z>
- </Vector3>
- </Properties>
- </Item>
- <Item class="MeshPart" referent="RBX4DD798A5ABF84DE4A4A1F013338850C4">
- <Properties>
- <bool name="Anchored">true</bool>
- <float name="BackParamA">-0.5</float>
- <float name="BackParamB">0.5</float>
- <token name="BackSurface">0</token>
- <token name="BackSurfaceInput">0</token>
- <float name="BottomParamA">-0.5</float>
- <float name="BottomParamB">0.5</float>
- <token name="BottomSurface">0</token>
- <token name="BottomSurfaceInput">0</token>
- <CoordinateFrame name="CFrame">
- <X>-6.33999777</X>
- <Y>2.01003408</Y>
- <Z>-9.59000397</Z>
- <R00>1</R00>
- <R01>0</R01>
- <R02>0</R02>
- <R10>0</R10>
- <R11>1</R11>
- <R12>0</R12>
- <R20>0</R20>
- <R21>0</R21>
- <R22>1</R22>
- </CoordinateFrame>
- <bool name="CanCollide">false</bool>
- <token name="CollisionFidelity">0</token>
- <int name="CollisionGroupId">0</int>
- <Color3uint8 name="Color3uint8">4279308561</Color3uint8>
- <PhysicalProperties name="CustomPhysicalProperties">
- <CustomPhysics>false</CustomPhysics>
- </PhysicalProperties>
- <float name="Elasticity">0.5</float>
- <float name="Friction">0.300000012</float>
- <float name="FrontParamA">-0.5</float>
- <float name="FrontParamB">0.5</float>
- <token name="FrontSurface">0</token>
- <token name="FrontSurfaceInput">0</token>
- <Vector3 name="InitialSize">
- <X>50</X>
- <Y>99.167099</Y>
- <Z>52.5730324</Z>
- </Vector3>
- <float name="LeftParamA">-0.5</float>
- <float name="LeftParamB">0.5</float>
- <token name="LeftSurface">0</token>
- <token name="LeftSurfaceInput">0</token>
- <bool name="Locked">true</bool>
- <token name="Material">288</token>
- <Content name="MeshID"><url>rbxassetid://667330318</url></Content>
- <Content name="MeshId"><url>rbxassetid://667330318</url></Content>
- <string name="Name">HighPoly</string>
- <BinaryString name="PhysicsData"><![CDATA[Q1NHUEhTAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAgD9gAAAA
- BAAAABodXUH53SVCZuHJtgAAAACNVUZCwFn8tguniEAL3iVCQkpSQQAAyEGxRsZAQvcBQQun
- iEAK3iVCTkpSwYe4kEGQIKBBeEpSwQAAAAClRsZAyUrSwVHiMsEJ3iVCKPcBwVHiMsEK3iVC
- GvcBQQAAAAC1RsZAyUrSQQAAyMGoRsZAQ/cBwQuniMDetwLCTkpSQYe4kME+yUjBeEpSQRod
- XcHMtwLCZuHJNgAAAACNVUbCqP8ON6E2d8GlRsZAPyGqwSp96MBxwyfBheKywaE2d0G1RsZA
- PiGqQUArmEFiwyfBoRxdQaE2d0GlRsZAPyGqwQAAyEGoRsZAQ/cBwUArmEFmwyfBnBxdwaE2
- d8G1RsZAPiGqQUArmMGknY9BnhxdQQAAyMGxRsZAQvcBQfMd3UBryUjB9yCqwXPiskE4yUjB
- 1TsoNvMd3UBlyUjB+iCqQYe4kMFDyUjBc0pSwSp96MBqwyfBh+KyQUAXvMH5wifBRJYGNlHi
- MkHetwLCGvcBwbQAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAQAAAAAAAAAEAAAA
- AAAAAAUAAAAEAAAABgAAAAcAAAAEAAAABwAAAAEAAAAIAAAACQAAAAIAAAAIAAAAAgAAAAEA
- AAAIAAAAAQAAAAcAAAAIAAAABwAAAAoAAAALAAAADAAAAA0AAAALAAAADQAAAA4AAAAPAAAA
- BgAAABAAAAAPAAAACgAAAAcAAAAPAAAABwAAAAYAAAARAAAAEgAAAAMAAAARAAAAAwAAAAIA
- AAARAAAAAgAAAAkAAAATAAAABgAAAAQAAAATAAAABAAAAAUAAAAUAAAAFQAAABMAAAAUAAAA
- EwAAAAUAAAAUAAAABQAAAAAAAAAUAAAAAAAAAAMAAAAWAAAACQAAAAgAAAAWAAAACAAAABcA
- AAAYAAAADAAAABYAAAAYAAAAFgAAABcAAAAYAAAAFwAAAAgAAAAYAAAACAAAAAoAAAAZAAAA
- BgAAABMAAAAZAAAAEwAAABUAAAAZAAAADgAAABAAAAAZAAAAEAAAAAYAAAAaAAAAFQAAABQA
- AAAaAAAAFAAAAAMAAAAaAAAAAwAAABIAAAAaAAAAEgAAAA4AAAAbAAAAEgAAABEAAAAbAAAA
- EQAAAAkAAAAbAAAADgAAABIAAAAbAAAACwAAAA4AAAAcAAAACgAAAA8AAAAcAAAADwAAABAA
- AAAcAAAAEAAAAA4AAAAcAAAADgAAAA0AAAAdAAAACwAAABsAAAAdAAAAGwAAAAkAAAAdAAAA
- CQAAABYAAAAdAAAADAAAAAsAAAAdAAAAFgAAAAwAAAAeAAAACgAAABwAAAAeAAAAHAAAAA0A
- AAAeAAAADQAAAAwAAAAeAAAADAAAABgAAAAeAAAAGAAAAAoAAAAfAAAAFQAAABoAAAAfAAAA
- GgAAAA4AAAAfAAAADgAAABkAAAAfAAAAGQAAABUAAAA=]]></BinaryString>
- <float name="Reflectance">0</float>
- <float name="RightParamA">-0.5</float>
- <float name="RightParamB">0.5</float>
- <token name="RightSurface">0</token>
- <token name="RightSurfaceInput">0</token>
- <Vector3 name="RotVelocity">
- <X>0</X>
- <Y>0</Y>
- <Z>0</Z>
- </Vector3>
- <BinaryString name="Tags"></BinaryString>
- <Content name="TextureID"><null></null></Content>
- <float name="TopParamA">-0.5</float>
- <float name="TopParamB">0.5</float>
- <token name="TopSurface">0</token>
- <token name="TopSurfaceInput">0</token>
- <float name="Transparency">0</float>
- <Vector3 name="Velocity">
- <X>0</X>
- <Y>0</Y>
- <Z>0</Z>
- </Vector3>
- <Vector3 name="size">
- <X>2</X>
- <Y>4</Y>
- <Z>2</Z>
- </Vector3>
- </Properties>
- </Item>
- </Item>
- <Item class="Folder" referent="RBXB593B0A35E51490694F6889B5D36881A">
- <Properties>
- <string name="Name">2D</string>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ScreenGui" referent="RBXD3F45BAB5AEB48599E786A8578AE5671">
- <Properties>
- <int name="DisplayOrder">0</int>
- <bool name="Enabled">true</bool>
- <string name="Name">Profile</string>
- <bool name="ResetOnSpawn">true</bool>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ModuleScript" referent="RBX95E451CED7F44182B68AF1E5AC06A33D">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Code</string>
- <string name="ScriptGuid">{B252AF98-3FEA-4131-8A88-1BB84B38FE98}</string>
- <ProtectedString name="Source"><![CDATA[return function(Remote, Data)
- local Alias, Bio, Color, Image = Data.Alias, Data.Bio, Data.Color, Data.Image;
- local Gui = script.Parent;
- local Frame = Gui:WaitForChild'Frame';
- local Update = Remote.Construct'Send'.String'PUpdate'.Limit(1).Mute();
- local A, B, C, I, D = Frame:WaitForChild'Alias', Frame:WaitForChild'Bio', Frame:WaitForChild'Color', Frame:WaitForChild'Image', Frame:WaitForChild'Display';
- local Done = Frame:WaitForChild'Done';
- script:Destroy();
- local Child = Frame:GetChildren();
- local CColor = BrickColor.new(Color);
- A.Text = Alias;
- B.Text = Bio;
- C.Text = tostring(CColor);
- I.Text = Image;
- D.Image = 'rbxassetid://' .. Image;
- local function SetUiColor(Col)
- for Idx = 1, #Child do
- local K = Child[Idx];
- if K:IsA'GuiObject' and (K.Name ~= 'Outside') then
- K.BackgroundColor3 = Col;
- end;
- end;
- end;
- SetUiColor(CColor.Color);
- I.Changed:Connect(function(Why)
- if (Why == 'Text') then
- local Tx = I.Text;
- if tonumber(Tx) then
- D.Image = 'rbxassetid://' .. I.Text;
- end;
- end;
- end);
- A.Changed:Connect(function(Why)
- if (Why == 'Text') then
- A.Text = A.Text:sub(1, 16);
- end;
- end);
- B.Changed:Connect(function(Why)
- if (Why == 'Text') then
- A.Text = A.Text:sub(1, 200);
- end;
- end);
- C.Changed:Connect(function(Why)
- if (Why == 'Text') then
- CColor = BrickColor.new(C.Text);
- SetUiColor(CColor.Color);
- end;
- end);
- Done.MouseButton1Click:Connect(function()
- Update.JSON{
- Alias = A.Text;
- Bio = B.Text;
- Color = CColor.Number;
- Image = I.Text;
- }.End();
- Remote.Send('RemoveGui', Gui);
- end);
- Frame.Visible = true;
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBXEF9906F9F233417CB3E476E95A289BAA">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">true</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Frame</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0.200000003</XS>
- <XO>0</XO>
- <YS>0.200000003</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.200000003</XS>
- <XO>0</XO>
- <YS>0.200000003</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- <Item class="UIAspectRatioConstraint" referent="RBX20EC1DD5557741A0A849FC0485D9B573">
- <Properties>
- <float name="AspectRatio">1</float>
- <token name="AspectType">1</token>
- <token name="DominantAxis">0</token>
- <string name="Name">Aspect</string>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="TextLabel" referent="RBX11FB467ED7344DFB8999A0BAAF57DD5C">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">8</token>
- <int name="LayoutOrder">0</int>
- <bool name="Localize">true</bool>
- <string name="Name">Top</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Profile</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">0</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- <Item class="TextBox" referent="RBXB722548705FB4A51901FD5FFF53DA6B0">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClearTextOnFocus">false</bool>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">7</token>
- <int name="LayoutOrder">0</int>
- <bool name="MultiLine">false</bool>
- <string name="Name">Alias</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>0.200000003</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <bool name="ShowNativeInput">true</bool>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Alias</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">0.400000006</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- <Item class="TextBox" referent="RBX68C7929071124663AE21F42A42966633">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClearTextOnFocus">false</bool>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">7</token>
- <int name="LayoutOrder">0</int>
- <bool name="MultiLine">false</bool>
- <string name="Name">Bio</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>0.300000012</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <bool name="ShowNativeInput">true</bool>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.699999988</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">No Bio.</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">0.400000006</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">0</token>
- <token name="TextYAlignment">0</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- <Item class="ImageLabel" referent="RBX3EAB193DB28F4775BEEC112CA48ECA08">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <Content name="Image"><url>rbxassetid://133293265</url></Content>
- <Color3 name="ImageColor3">4294967295</Color3>
- <Vector2 name="ImageRectOffset">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Vector2 name="ImageRectSize">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <float name="ImageTransparency">0</float>
- <int name="LayoutOrder">0</int>
- <string name="Name">Display</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.300000012</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <token name="ScaleType">0</token>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.699999988</XS>
- <XO>0</XO>
- <YS>0.699999988</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <Rect2D name="SliceCenter">
- <min>
- <X>0</X>
- <Y>0</Y>
- </min>
- <max>
- <X>0</X>
- <Y>0</Y>
- </max>
- </Rect2D>
- <BinaryString name="Tags"></BinaryString>
- <UDim2 name="TileSize">
- <XS>1</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- <Item class="TextBox" referent="RBX36D30CAC59164D0CA4911CB759407A90">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClearTextOnFocus">false</bool>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">7</token>
- <int name="LayoutOrder">0</int>
- <bool name="MultiLine">false</bool>
- <string name="Name">Image</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.200000003</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <bool name="ShowNativeInput">true</bool>
- <UDim2 name="Size">
- <XS>0.699999988</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Image</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">0.400000006</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBX120CF02FB2EE4A80B51375BE82B94DC5">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Frame</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- <Item class="TextButton" referent="RBX879B9FF576F14C6598B3AE8B39A4B949">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <bool name="AutoButtonColor">true</bool>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">8</token>
- <int name="LayoutOrder">0</int>
- <bool name="Modal">false</bool>
- <string name="Name">Done</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <bool name="Selected">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.699999988</XS>
- <XO>0</XO>
- <YS>0.200000003</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Done</string>
- <Color3 name="TextColor3">4278233600</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4294967295</Color3>
- <float name="TextStrokeTransparency">0.800000012</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- <Item class="TextBox" referent="RBX14312DFF38D84BC28E3864D2DFCE9F4E">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">0.699999988</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClearTextOnFocus">false</bool>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">7</token>
- <int name="LayoutOrder">0</int>
- <bool name="MultiLine">false</bool>
- <string name="Name">Color</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <bool name="ShowNativeInput">true</bool>
- <UDim2 name="Size">
- <XS>1.70000005</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Color</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">0.400000006</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBX5ACA86055743494CA5E6A0331E2A2A91">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4278190080</Color3>
- <float name="BackgroundTransparency">0.5</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Outside</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>-0.0500000007</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1.70000005</XS>
- <XO>0</XO>
- <YS>0.0500000007</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBX31F34365C0E2474E8A687B9B811ED7FF">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4278190080</Color3>
- <float name="BackgroundTransparency">0.5</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Outside</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>-0.0500000007</XS>
- <XO>0</XO>
- <YS>-0.0500000007</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.0500000007</XS>
- <XO>0</XO>
- <YS>1.20000005</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBX714A2BE0815143ACAD6E88EBCA033AB3">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4278190080</Color3>
- <float name="BackgroundTransparency">0.5</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Outside</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>1.70000005</XS>
- <XO>0</XO>
- <YS>-0.0500000007</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.0500000007</XS>
- <XO>0</XO>
- <YS>1.20000005</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBXCBC1EE49BD924654921BCA1731475E47">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4278190080</Color3>
- <float name="BackgroundTransparency">0.5</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Outside</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>1.10000002</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1.70000005</XS>
- <XO>0</XO>
- <YS>0.0500000007</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- </Item>
- </Item>
- <Item class="ScreenGui" referent="RBXFC6B1E592BE24DC0BF35F81089E1AB16">
- <Properties>
- <int name="DisplayOrder">0</int>
- <bool name="Enabled">true</bool>
- <string name="Name">Commands</string>
- <bool name="ResetOnSpawn">true</bool>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ModuleScript" referent="RBX984F62C79FC84133A6056626DBC9D4D2">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Code</string>
- <string name="ScriptGuid">{36788681-A20B-4D16-A27C-6A039CA12A26}</string>
- <ProtectedString name="Source"><![CDATA[return function(Remote, Data)
- local Gui = script.Parent;
- script:Destroy();
- local Main = {};
- local pcall = pcall;
- local UDim2 = UDim2.new;
- local Box = Instance.new'TextBox';
- local Step = Remote.RunService.Heartbeat;
- local Rand = BrickColor.Random().Color;
- local Cons = Data.Bind;
- local function Focus()
- pcall(Box.TweenPosition, Box, UDim2(0, 0, 0, 0), 'In', 'Back', 0.3, true);
- for Idx = 1, #Main do
- local I = Main[Idx];
- pcall(I.TweenPosition, I, UDim2((Idx - 1) / 25, 0, 0, 0), 'In', 'Back', 0.3, true);
- Step:wait();
- end;
- end;
- local function Retreat()
- pcall(Box.TweenPosition, Box, UDim2(0, 0, 0, -38), 'Out', 'Sine', 0.3, true);
- for Idx = 1, #Main do
- local I = Main[Idx];
- pcall(I.TweenPosition, I, UDim2((Idx - 1) / 25, 0, 0, -38), 'Out', 'Sine', 0.3, true);
- Step:wait();
- end;
- end;
- Box.Size = UDim2(1, 0, 0, 38);
- Box.Position = UDim2(0, 0, 0, -38);
- Box.BackgroundTransparency = 1;
- Box.Font = 'SciFi';
- Box.TextColor3 = Color3.new(1, 1, 1);
- Box.TextStrokeColor3 = Color3.new(0, 0, 0);
- Box.TextStrokeTransparency = 0.3;
- Box.TextScaled = true;
- Box.TextWrapped = true;
- Box.TextYAlignment = 'Top';
- -- Box.TextXAlignment = 'Left';
- for Idx = 1, 25 do
- local Frame = Instance.new'Frame';
- local R, G, B = Rand.r / (Idx / 25), Rand.g / (Idx / 25), Rand.b / (Idx / 25);
- Main[#Main + 1] = Frame;
- Frame.Transparency = 1 - (1 / Idx);
- Frame.Position = UDim2((Idx - 1) / 25, 0, 0, -38);
- Frame.Size = UDim2(0.04, 0, 0, 38);
- Frame.BackgroundColor3 = Color3.new(R, G, B);
- Frame.BorderSizePixel = 0;
- Frame.Name = 'KType' .. Idx;
- Frame.Parent = Gui;
- end;
- if Data.Enabled then
- Remote.UserInputService.InputBegan:Connect(function(Key, Process)
- if (not Process) and (Key.KeyCode.Name == Cons) then
- Box:CaptureFocus();
- end;
- end);
- Box.Focused:Connect(Focus);
- Box.FocusLost:Connect(function() -- Got bored and decided best solution.
- Box.Text = '';
- Retreat();
- end);
- end;
- Box.Name = 'CeleryBox';
- Box.Text = '';
- Box.Parent = Gui;
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- </Item>
- <Item class="ScreenGui" referent="RBX9DD9962F1BD54889A528D129288FDA83">
- <Properties>
- <int name="DisplayOrder">0</int>
- <bool name="Enabled">true</bool>
- <string name="Name">Message</string>
- <bool name="ResetOnSpawn">true</bool>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="TextLabel" referent="RBXA701F1B502C94AA4B363C3BFE850B13B">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">1</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">8</token>
- <int name="LayoutOrder">0</int>
- <bool name="Localize">true</bool>
- <string name="Name">Main</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0.200000003</XS>
- <XO>0</XO>
- <YS>-0.349999994</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.600000024</XS>
- <XO>0</XO>
- <YS>0.300000012</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">What, seen a ghost? No wonder no one heard your screams.</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">1</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">4</int>
- </Properties>
- <Item class="TextLabel" referent="RBX8BB5D6F1CAD64401BB3EEACB980DF95A">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4285756275</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">8</token>
- <int name="LayoutOrder">0</int>
- <bool name="Localize">true</bool>
- <string name="Name">Shade</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>-2</XO>
- <YS>0</YS>
- <YO>-2</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">What, seen a ghost? No wonder no one heard your screams.</string>
- <Color3 name="TextColor3">4278190080</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">1</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">3</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBX14DB20A42EDF45299E221DFA3EC4A3D9">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4282795590</Color3>
- <float name="BackgroundTransparency">0</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">S2</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>-3</XO>
- <YS>0</YS>
- <YO>-3</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBXDF5E21A85F1445378872FD8E92ABB912">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4287401100</Color3>
- <float name="BackgroundTransparency">0</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">S1</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- <Item class="Frame" referent="RBX80A9E0EC89C440BC96B987CFD6FC30A0">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4282795590</Color3>
- <float name="BackgroundTransparency">0</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">S3</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>-3</XO>
- <YS>-0.100000001</YS>
- <YO>-3</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- <Item class="TextLabel" referent="RBX3C73870E8DD34B0DB1F0A804C0D03C5D">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4287401100</Color3>
- <float name="BackgroundTransparency">0</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">5</token>
- <int name="LayoutOrder">0</int>
- <bool name="Localize">true</bool>
- <string name="Name">User</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>-0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>0.100000001</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Pumpkin Pie</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">8</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">1</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- </Item>
- </Item>
- <Item class="ModuleScript" referent="RBXFB5DD364A9AC441A8049B7019171CDE2">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Code</string>
- <string name="ScriptGuid">{22C9E55A-C778-485E-905B-AE07EF5A1120}</string>
- <ProtectedString name="Source"><![CDATA[return function(Remote, Data)
- local Gui = script.Parent;
- local PlG = Gui.Parent;
- script:Destroy();
- local GuiName = Gui.Name;
- local Dismiss = Instance.new'BindableEvent';
- local T1 = Gui:WaitForChild'Main';
- Dismiss.Name = '__Dismiss';
- Dismiss.Parent = Gui;
- Remote.QThread(function()
- Dismiss.Event:wait();
- delay(2, function() Remote.Send('RemoveGui', Gui); end);
- T1:TweenPosition(UDim2.new(0.2, 0, 1, 0), 'In', 'Back', 2, false);
- end);
- local T2, N = T1:WaitForChild'Shade', T1:WaitForChild'User';
- local Name, Text = Data.Sender, Data.Message;
- T1.Text, T2.Text = Text, Text;
- N.Text = Name;
- local Child = PlG:GetChildren();
- for Idx = 1, #Child do
- local G = Child[Idx];
- if (G.Name == GuiName) and (G ~= Gui) then
- local Dis = G:FindFirstChild'__Dismiss';
- if Dis then
- Dis:Fire();
- end;
- end;
- end;
- T1:TweenPosition(UDim2.new(0.2, 0, 0.35, 0), 'Out', 'Bounce', 2, true, function() wait(math.log(#Text) * 0.7); Dismiss:Fire(); end);
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- </Item>
- <Item class="ScreenGui" referent="RBX0145DE756D514C5EA78D9157107014F8">
- <Properties>
- <int name="DisplayOrder">0</int>
- <bool name="Enabled">true</bool>
- <string name="Name">Notepad</string>
- <bool name="ResetOnSpawn">true</bool>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="Frame" referent="RBX092536BFAF1E4FD9BFAEA83B61843858">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4278190080</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">true</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Back</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0.300000012</XS>
- <XO>0</XO>
- <YS>0.300000012</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.300000012</XS>
- <XO>0</XO>
- <YS>0.0299999993</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">2</int>
- </Properties>
- <Item class="TextLabel" referent="RBX332E14B58DCD4DB3B7C02FC67140DC38">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4278190080</Color3>
- <float name="BackgroundTransparency">0</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">3</token>
- <int name="LayoutOrder">0</int>
- <bool name="Localize">true</bool>
- <string name="Name">Disp</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text"></string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">0</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">0</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">3</int>
- </Properties>
- <Item class="TextButton" referent="RBX04ACF5F3AC27406A97FAC24B8B1B732D">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <bool name="AutoButtonColor">true</bool>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">12</token>
- <int name="LayoutOrder">0</int>
- <bool name="Modal">false</bool>
- <string name="Name">Exit</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0.899999976</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <bool name="Selected">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.100000001</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Exit</string>
- <Color3 name="TextColor3">4294901760</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">1</float>
- <float name="TextTransparency">1</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">4</int>
- </Properties>
- </Item>
- <Item class="TextButton" referent="RBX4D94C637FC0D4390BF5258492E5105D5">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <bool name="AutoButtonColor">true</bool>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">12</token>
- <int name="LayoutOrder">0</int>
- <bool name="Modal">false</bool>
- <string name="Name">Save</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0.75</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <bool name="Selected">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.150000006</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Save</string>
- <Color3 name="TextColor3">4278255360</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">1</float>
- <float name="TextTransparency">1</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">4</int>
- </Properties>
- </Item>
- <Item class="TextButton" referent="RBXBD2B2712750C4C7D95DE0E3B5318C96B">
- <Properties>
- <bool name="Active">true</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <bool name="AutoButtonColor">true</bool>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">12</token>
- <int name="LayoutOrder">0</int>
- <bool name="Modal">false</bool>
- <string name="Name">Clear</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0.600000024</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <bool name="Selected">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>0.150000006</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text">Clear</string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">1</float>
- <float name="TextTransparency">1</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">2</token>
- <token name="TextYAlignment">1</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">4</int>
- </Properties>
- </Item>
- </Item>
- <Item class="Frame" referent="RBX1991FEBF59444ADAA34C6EDFC0736ACE">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294967295</Color3>
- <float name="BackgroundTransparency">1</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <int name="LayoutOrder">0</int>
- <string name="Name">Notes</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">false</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <token name="Style">0</token>
- <BinaryString name="Tags"></BinaryString>
- <bool name="Visible">true</bool>
- <int name="ZIndex">1</int>
- </Properties>
- </Item>
- </Item>
- <Item class="ModuleScript" referent="RBXA1E2329D326C41E6AA0B6C09D533A2FA">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Code</string>
- <string name="ScriptGuid">{FD557FE0-D4A5-483F-A16D-65E04A17EC1B}</string>
- <ProtectedString name="Source"><![CDATA[return function(Shared, Data)
- local Gui = script.Parent;
- local Note = script:WaitForChild'Note':Clone();
- local Save = Shared.Construct'Request'.String('SaveNotepad', 1);
- script.Parent = nil;
- local Start = Instance.new'BindableEvent';
- local Beat = Shared.RunService.Heartbeat;
- local Back = Gui:WaitForChild'Back';
- local Disp = Back:WaitForChild'Disp';
- local Notes = Back:WaitForChild'Notes';
- local SaveB = Disp:WaitForChild'Save';
- local ExitB = Disp:WaitForChild'Exit';
- local CleaB = Disp:WaitForChild'Clear';
- local FrameConnect, CreateF;
- function FrameConnect(Frame)
- local Pos = Frame.Position;
- Frame.FocusLost:Connect(function(Enter)
- local Child = Notes:GetChildren();
- local Text = Frame.Text;
- local Trim = Text:gsub('%s', '');
- if (Trim == '') or (not Trim) and (#Child > 1) then
- Frame:Destroy();
- for I, F in ipairs(Child) do
- pcall(F.TweenPosition, F, UDim2.new(0, 0, I - 1, 0), 'Out', 'Sine', 1.5, true);
- end;
- elseif Enter then
- CreateF():CaptureFocus();
- end
- end);
- end;
- function CreateF()
- local Frame = Note:Clone();
- Frame.Text = '';
- Frame.Parent = Notes;
- FrameConnect(Frame);
- Frame.Visible = true;
- pcall(Frame.TweenPosition, Frame, UDim2.new(0, 0, #Notes:GetChildren() - 1, 0), 'Out', 'Sine', 1.5, true);
- return Frame;
- end;
- Disp.BackgroundColor3 = BrickColor.Random().Color;
- Disp:TweenSize(UDim2.new(1, 0, 1, 0), 'In', 'Sine', 2, true, function()
- for Letter in string.gmatch('Notepad', '.') do
- Disp.Text = Disp.Text .. Letter;
- Beat:wait();
- end;
- for T = 50, 0, -1 do
- local Val = T/50;
- CleaB.TextStrokeTransparency = Val;
- SaveB.TextStrokeTransparency = Val;
- ExitB.TextStrokeTransparency = Val;
- CleaB.TextTransparency = Val;
- SaveB.TextTransparency = Val;
- ExitB.TextTransparency = Val;
- Beat:wait();
- end;
- Start:Fire();
- end);
- Start.Event:wait();
- CleaB.MouseButton1Click:Connect(function()
- Notes:ClearAllChildren();
- CreateF();
- end);
- ExitB.MouseButton1Click:Connect(function()
- if Save.Limit(1) then
- Back:TweenPosition(UDim2.new(Back.Position.X.Scale, 0, -1, 0), 'In', 'Bounce', 4, false);
- Save.Mute().Object(Gui, 2).End();
- end;
- end);
- SaveB.MouseButton1Click:Connect(function()
- local Final = '';
- for _, Frame in next, Notes:GetChildren() do
- local Text = Frame.Text;
- if Text:gsub('%s', '') ~= '' then
- Final = Final .. Text .. '\n';
- end;
- end;
- Save.String(Final, 2).End();
- end);
- do
- for Line in Data.Notes:gmatch'[^\n]*' do
- if Line and (Line:gsub('%s', '') ~= '') then
- CreateF().Text = Line;
- end;
- end;
- CreateF();
- end;
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="TextBox" referent="RBX8C5CEC5A9D134666BA4C745EF2D7B3E5">
- <Properties>
- <bool name="Active">false</bool>
- <Vector2 name="AnchorPoint">
- <X>0</X>
- <Y>0</Y>
- </Vector2>
- <Color3 name="BackgroundColor3">4294506744</Color3>
- <float name="BackgroundTransparency">0</float>
- <Color3 name="BorderColor3">4279970357</Color3>
- <int name="BorderSizePixel">0</int>
- <bool name="ClearTextOnFocus">false</bool>
- <bool name="ClipsDescendants">false</bool>
- <bool name="Draggable">false</bool>
- <token name="Font">14</token>
- <int name="LayoutOrder">0</int>
- <bool name="MultiLine">false</bool>
- <string name="Name">Note</string>
- <Ref name="NextSelectionDown">null</Ref>
- <Ref name="NextSelectionLeft">null</Ref>
- <Ref name="NextSelectionRight">null</Ref>
- <Ref name="NextSelectionUp">null</Ref>
- <UDim2 name="Position">
- <XS>0</XS>
- <XO>0</XO>
- <YS>0</YS>
- <YO>0</YO>
- </UDim2>
- <float name="Rotation">0</float>
- <bool name="Selectable">true</bool>
- <Ref name="SelectionImageObject">null</Ref>
- <bool name="ShowNativeInput">true</bool>
- <UDim2 name="Size">
- <XS>1</XS>
- <XO>0</XO>
- <YS>1</YS>
- <YO>0</YO>
- </UDim2>
- <token name="SizeConstraint">0</token>
- <bool name="SizeFromContents">false</bool>
- <BinaryString name="Tags"></BinaryString>
- <string name="Text"></string>
- <Color3 name="TextColor3">4294967295</Color3>
- <bool name="TextScaled">true</bool>
- <float name="TextSize">14</float>
- <Color3 name="TextStrokeColor3">4278190080</Color3>
- <float name="TextStrokeTransparency">0</float>
- <float name="TextTransparency">0</float>
- <bool name="TextWrapped">true</bool>
- <token name="TextXAlignment">0</token>
- <token name="TextYAlignment">0</token>
- <bool name="Visible">true</bool>
- <int name="ZIndex">3</int>
- </Properties>
- </Item>
- </Item>
- </Item>
- </Item>
- <Item class="Folder" referent="RBXF9591049B61F4FF2934362DD3C7A1D12">
- <Properties>
- <string name="Name">Plugins</string>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- <Item class="ModuleScript" referent="RBX3FE067B7FCB2487AB039BF95B43D7115">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Adonis</string>
- <string name="ScriptGuid">{DCEAFF26-94C8-4480-ACE0-61B007DD5CB8}</string>
- <ProtectedString name="Source"><![CDATA[Clear = nil;
- return function()
- error'Module not yet compatible.';
- Clear.Assert(not Clear.AdonisR, 'A version of NemeDonis is already present.');
- local Static = Clear.Settings.Players;
- local MuteList = {};
- local Creators = {};
- local Owners = {};
- local Admins = {};
- local Mods = {};
- for _, User in ipairs(Static.Bans) do
- table.insert(MuteList, User:match('^[^;]+'));
- end;
- for _, User in ipairs(Static.Zero) do
- table.insert(Creators, User:match('^[^;]+'));
- end;
- for _, User in ipairs(Static.One) do
- table.insert(Owners, User:match('^[^;]+'));
- end;
- for _, User in ipairs(Static.Two) do
- table.insert(Admins, User:match('^[^;]+'));
- end;
- for _, User in ipairs(Static.Three) do
- table.insert(Mods, User:match('^[^;]+'));
- end;
- local Return = Clear.GlobalBlocks.__Bypass('__Adonis_MODULE_MUTEX');
- --require(359948692){Settings={Creators={70540486}}}
- Clear.AdonisR = require(359948692){
- Settings = {
- DataStore = 'OOOOOOOOOF';
- Creators = Creators;
- Owners = Owners;
- Admins = Admins;
- Moderators = Mods;
- Muted = MuteList;
- Trello_Enabled = true;
- Theme = 'Colorize';
- MobileTheme = 'Colorize';
- };
- };
- Return(); -- Make it go back to normal.
- return Clear.AdonisR;
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBXEF8DDD60CA79404886F81CA0BE0068DD">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">AdvChatSpoof</string>
- <string name="ScriptGuid">{AB0003BF-25A0-4274-B4E5-088A3DEEFA43}</string>
- <ProtectedString name="Source"><![CDATA[return function(Clear)
- local Commands = Clear.Commands;
- local Event = Clear.ReplicatedStorage:WaitForChild('DefaultChatSystemChatEvents'):WaitForChild('OnNewMessage');
- Commands.New{
- Names = {'SChat', 'SpoofChat'};
- Desc = 'Sends everyone the <Message> as <Name>.';
- Perms = {'User'};
- Args = {'Name', 'Message'};
- Function = function(Player, Args)
- Clear.Assert(Args[1] and Args[2], 'Invalid field given.')
- Event:FireAllClients({
- MessageLength = #Args[2];
- FromSpeaker = Args[1];
- OriginalChannel = 'All';
- Message = Args[2];
- Time = os.time();
- ID = 0;
- IsFiltered = true;
- MessageType = 'Message';
- ExtraData = {
- NameColor = Clear:ChatColor(Args[1]);
- Tags = {};
- };
- }, 'All');
- end;
- };
- return 'Chat Spoofed.';
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBX2C40C20A5E3F442ABD1C1C3922984739">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Revex</string>
- <string name="ScriptGuid">{C1492FAE-9EC0-4403-B55E-1318AED71423}</string>
- <ProtectedString name="Source"><![CDATA[Clear = nil;
- return function()
- error'Module Auth has been removed.';
- Clear.Glass = require(582032266);
- return Clear.Glass;
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- <Item class="ModuleScript" referent="RBXABABDC39EE7C4B319E2818F39AD14877">
- <Properties>
- <Content name="LinkedSource"><null></null></Content>
- <string name="Name">Voidacity</string>
- <string name="ScriptGuid">{CC4405E6-DAEA-46E4-8DDE-D14CF61A36AF}</string>
- <ProtectedString name="Source"><![CDATA[Clear = nil;
- return function()
- error'Module not yet compatible.';
- local Commands = Clear.Commands;
- local Pastebin
- local Discord
- pcall(function()
- local Auth = Clear.RerAuth;
- Discord = Clear.Discord(Clear.HashKeys.Pillow);
- Pastebin = Clear.HttpRemote'Pastebin';
- Pastebin.Login(Auth.Pastebin.Dev, 'Rerumu', Auth.Pastebin.Pass);
- end);
- Commands:New{
- Name = {'SBChat', 'VoidChat'};
- Desc = 'Sends everyone the <Message> as <Name> in SB.';
- Level = 4;
- Hidden = false;
- Args = {'Name', 'Message'};
- Function = function(Player, Args)
- local Chat = Clear:Create'StringValue'{
- Name = 'SB_Chat';
- Value = (Args[1] or 'Nemesis') .. '/' .. (Args[2] or 'nil');
- };
- for _, Player in pairs(Clear:GrabPlayer('all')) do
- Chat.Parent = Player;
- end;
- Clear.Debris:AddItem(Chat, 0.0001);
- end;
- };
- Commands:New{
- Name = {'SBScript', 'VoidScript'};
- Desc = 'Forces the creation of <Name> script onto <Players>.';
- Level = 2;
- Hidden = false;
- Args = {'Players', 'Name'};
- Function = function(Player, Args)
- Clear.Assert(Args[2], 'No Name provided.')
- for _, Player in pairs(Commands:GetPlayers(Player, Args[1])) do
- pcall(function()
- Player:FindFirstChildOfClass('PlayerGui').SB_DataTransfer.SB_CommandRemote.Value = 'create/' .. Args[2];
- end);
- end;
- end;
- };
- Commands:New{
- Name = {'SBSource', 'VoidSource'};
- Desc = 'Forces the creation of <Name> script onto <Players> with <Source>.';
- Level = 3;
- Hidden = false;
- Args = {'Players', 'Name', 'Source'};
- Function = function(Player, Args)
- Clear.Assert(Args[2], 'No Name provided.')
- Clear.Assert(Args[3], 'No Source provided.')
- for _, Player in pairs(Commands:GetPlayers(Player, Args[1])) do
- pcall(function()
- local Transf = Player:FindFirstChildOfClass('PlayerGui').SB_DataTransfer.SB_CommandRemote;
- Transf.Value = 'createsource/' .. Args[2] .. '/' .. Args[3];
- Clear.RunService.Stepped:wait();
- Transf.Value = 'save/' .. Args[2];
- end);
- end;
- end;
- };
- Commands:New{
- Name = {'SBRun', 'VoidRun'};
- Desc = 'Forces <Players> to run <Name> if present.';
- Level = 4;
- Hidden = false;
- Args = {'Players', 'Name'};
- Function = function(Player, Args)
- Clear.Assert(Args[2], 'No Name provided.')
- for _, Player in pairs(Commands:GetPlayers(Player, Args[1])) do
- pcall(function()
- Player:FindFirstChildOfClass('PlayerGui').SB_DataTransfer.SB_CommandRemote.Value = 'run/' .. Args[2];
- end);
- end;
- end;
- };
- Commands:New{
- Name = {'SBExe', 'VoidExecute'};
- Desc = 'Forces <Players> to use <Message> with the command bar.';
- Level = 1;
- Hidden = false;
- Args = {'Players', 'Message'};
- Function = function(Player, Args)
- Clear.Assert(Args[2], 'No Message provided.')
- for _, Player in pairs(Commands:GetPlayers(Player, Args[1])) do
- pcall(function()
- Player:FindFirstChildOfClass('PlayerGui').SB_DataTransfer.SB_CommandRemote.Value = Args[2];
- end);
- end;
- end;
- };
- Commands:New{
- Name = {'SBSpread', 'SpreadNemesis'};
- Desc = 'Creates an instance of Nemesis in Players to spread the script.';
- Level = 5;
- Hidden = false;
- Args = {};
- Function = function(Player, Args)
- Commands:Run('VoidSource', Player, {'All', 'Nemesis', 'require(554147357);'});
- end;
- };
- Commands:New{
- Name = {'NoLiLog', 'GateLog'};
- Desc = 'Logs <Match> scripts and the like.';
- Level = 2;
- Hidden = false;
- Args = {'Match'};
- Function = function(Player, Args)
- Clear.Assert(Discord and Pastebin, 'An Http error happened.');
- local Key = (Args[1] or 'noligate') .. '.+';
- if Clear.LogNoLi then
- Clear.LogNoLi:Disconnect();
- Clear.LogNoLi = nil;
- Commands:Run('ColorNotify', Player, {nil, 1004, 'LiLog is now offline.'});
- else
- Clear.LogNoLi = Clear.Pconnect(Clear.Cross.Event, function(isLog, What)
- local Match = tostring(What);
- if (isLog == 'DiscordLog') and (Match:match'http.+' and Match:match(Key)) then
- local Return = Clear.DoGet(Match:match'http.+' or Match:match(Key));
- local Paste = Pastebin.Paste{Name = 'LOG_PASTE_' .. os.getunix(), Text = Return};
- Discord.HookMessage{
- content = Paste;
- username = 'Paste_Log';
- };
- end;
- end);
- Commands:Run('ColorNotify', Player, {nil, 28, 'LiLog is now online.'});
- end;
- end;
- };
- return 'Loaded SB.'
- end;]]></ProtectedString>
- <BinaryString name="Tags"></BinaryString>
- </Properties>
- </Item>
- </Item>
- </Item>
- </Item>
- </roblox>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement