About Lua_Plus
Lua_Plus is a Module
that will help you coding. It includes features like: choosing random item based on it’s rarity, downloading Models from a website, scaling your ScrollingFrame
based on it’s children and a lot more!
The Module
is getting expanded as I think of more useful functions.
How to use
You just need to require the Module
from your script, like this:
local lua_plus = require(--[[Location of Lua_Plus here.]])
I heavily recommend to put the Module
somewhere in ReplicatedStorage
as it is also useful in LocalScripts
.
Features
There are 12 features right now.
lua_plus.test()
Not useful for coding, returns true
as well as prints “lua_plus”.
Parameters: None.
Example of use:
lua_plus.test()
lua_plus.version()
Returns version of lua_plus Module
.
Parameters: None.
Example of use:
local version = lua_plus.version()
print(version)
lua_plus.insert(id, parent)
Inserts a Model
to your game by it’s id.
Notes: can only be used in game, Server Script
.
Parameters: id, parent.
Example of use:
lua_plus.insert(6503999156, script)
lua_plus.check_version()
Returns bool, string.
Notes: can only be used in game, Server Script
.
Parameters: None.
Example of use:
local updated, notes = lua_plus.check_version()
if updated then
print(notes)
else
warn(notes)
end
lua_plus.ungroup_model(model)
Ungroups selected Model
.
Parameters: model.
Example of use:
lua_plus.ungroup_model(game:GetService("Workspace"):WaitForChild("Model"))
lua_plus.return_xNumber(number, percentage)
Returns number.
Parameters: number, percentage.
Example of use:
local newNumber = lua_plus.return_xNumber(100, 10)
print(newNumber) --Prints 10 because it is 10% of 100.
lua_plus.pick_by_percenatage(namesT, percentageT)
Returns random item based on the percentage.
Parameters: table, table.
Example of use:
local tier = lua_plus.pick_by_percenatage({"Common", "Rare", "Legendary"}, {70, 25, 5})
print("Rolled out "..tier.." tier.")
lua_plus.player_from_disorted_string(str)
Returns Player
or nil from his disorted name, for example: “JeRMARtynOjM” will return Jermartynojm (as player) if he is on the Server.
Parameters: string.
Example of use:
local player = lua_plus.player_from_disorted_string("JeRMARtynOjM")
print(player) --Prints nil / Jermartynojm.
lua_plus.game_instance_from_string(str)
Returns Instance
or nil.
Parameters: string.
Example of use:
local workspaceW = lua_plus.game_instance_from_string("Workspace") --Returns Workspace Service
local model = lua_plus.game_instance_from_string("Workspace.Model") --Returns Workspace.Model as an Instance.
lua_plus.load(id, parent)
Inserts a Model
to your game by it’s id.
Notes: can only be used in command bar, Plugins
.
Parameters: id, parent.
Example of use:
lua_plus.load(6503999156, script)
lua_plus.update_canvas_based_on_children(scrollingFrame, uiAContentSizeElement, scrollingDirection)
Updates CanvasSize
based on it’s children.
Parameters: ScrollingFrame
, UI Element with Absolute Content Size property, scrolling direction.
Example of use:
lua_plus.update_canvas_based_on_children(script.Parent:WaitForChild("ScrollingFrame"), script.Parent:WaitForChild("ScrollingFrame"):WaitForChild("UIListLayout"), Enum.ScrollingDirection.XY)
lua_plus.get_touching_parts(part)
Returns :GetTouchingParts()
table.
Notes: main reason of me making this function is that :GetTouchingParts()
does not work with CanCollide
set to false.
Parameters: Part
instance.
Example of use:
local touching = lua_plus.get_touching_parts(script.Parent:WaitForChild("Part"))
print(touching)
Deprecated features
No deprecated features yet.
License
You can freely use it in your games unless you claim that you have made the Module
.
Get Lua_Plus
You can get your copy of a Module here: lua_plus - Roblox
Other
Thanks for reading, feel free to suggest more functions