Scripts.GetVar

Declaration

Scripts.GetVar(Tile ScriptTile)

Description

Returns all the variables from a ScriptTile in the form of a Dictionary.

--Gets the Tile object of the other ScriptTile, 
--and gets all the editor-exposed variables from it,
--then prints them in the Scripts Console
local otherScriptTile = World.GetTile(V2(4, 5), 0);
local variables = Scripts.GetVar(otherScriptTile);

for name, value in pairs(variables) do 
    Print(name .. ": " .. tostring(value));
end

--Prints a specific variable in the Scripts Console
Print("BlastForce: " .. variables["BlastForce"]);

Declaration

Scripts.GetVar(Tile ScriptTile, string Name)

Description

Returns the value of the Name variable from a ScriptTile.

--Gets the Tile object of the other ScriptTile, and gets the value of 
--the editor-exposed "BlastForce" variable then prints it in the Scripts Console
local otherScriptTile = World.GetTile(V2(4, 5), 0);
local force = Scripts.GetVar(otherScriptTile, "BlastForce");

Print(force);

Declaration

Scripts.GetVar(Dictionary<Tile> ScriptTiles)

Description

Returns all the variables from ScriptTiles in the form of a Dictionary of dictionaries.

--Gets the Tile objects of the other ScriptTiles, 
--and gets all the editor-exposed variables from them, 
--then prints them in the Scripts Console
local otherScriptTiles = {World.GetTile(V2(4, 5), 0), World.GetTile(V2(2, 5), 0), World.GetTile(V2(0, 5), 0)};
local scripts = Scripts.GetVar(otherScriptTiles);

for i, scriptVars in ipairs(scripts) do 
    for name, value in pairs(scriptVars) do 
        Print("Script Tile #" .. i .. " " .. name .. ": " .. tostring(value));
    end
end

--Prints a specific variable from a specific ScriptTile in the Scripts Console
Print("Script Tile #2 BlastForce: " .. scripts[2]["BlastForce"]);

Declaration

Scripts.GetVar(Dictionary<Tile> ScriptTiles, string Name)

Description

Returns the values of the Name variable from ScriptTiles in the form of a Dictionary.

--Gets the Tile objects of the other ScriptTiles, 
--and gets all the editor-exposed "BlastForce" variables then prints them in the Scripts Console
local otherScriptTiles = {World.GetTile(V2(4, 5), 0), World.GetTile(V2(2, 5), 0), World.GetTile(V2(0, 5), 0)};
local forces = Scripts.GetVar(otherScriptTiles, "BlastForce");

for i, force in ipairs(forces) do 
    Print("Script Tile #" .. i .. " BlastForce: " .. force);
end

--Prints a specific "BlastForce" from a specific ScriptTile in the Scripts Console
Print("Script Tile #2 BlastForce: " .. forces[2]);