BOLT - Library for Programming Easier and Faster [Not Recommended for Use]

⚠️ Bolt is not currently recommended for use

Details >

Bolt

22.3 BETA

Easier, Optimized, Faster

Website Getting Started Documentation GitHub Roblox

About

Bolt is a Library with the aim of making programming easier and faster for all developers. It is an open source project on GitHub. Bolt is a collection of simple functions for simplifying tasks. For example I can use Bolt to create a leaderstat with only one line of code: Bolt.NewLeaderstat(player, name, variableType) this is just one of many examples of what Bolt can do.

Getting Started

Setting up a Bolt powered project is very simple we have a guide on our website here.

Or you can use the video I made:


Documentation

Our website includes documentation in the form of tutorials and API references.

Tutorials


API References


Optimizing

If you are using Bolt for only one simple command in your game for example Bolt.Health.Kill() then your game may suffer from performance losses if you compared it to doing game.Players.LocalPlayer.Character.Humanoid.Health = 0 .However using Bolt for only one simple command like Bolt.Health.Kill().


It may come to a surprise to some people that Bolt improves performance in games where you take advantage of multiple functions. This is because instead of your game having to store each time you write game.Players.LocalPlayer.Character.Humanoid.Health = 0 you game simply has to store function

Bolt.Health.Kill(player)
	player.Character:WaitForChild("Humanoid").Health = 0
end

and then only having to write Bolt.Health.Kill() every other time. This is even an example which would have the largest performance impact with using Bolt although once used enough will gain extra performance. I would like to thank @R0bl0x10501050 for letting me know about this and that I should point out the fact that it may have a performance impact if only used once or twice. Once you get your head around it you will understand why you need to use Bolt several times before it has a performance gain.


Future

This isn't just a project that I released and that I'm never going to update again. This is a project which I will continue to support for a long time. I want to keep updating this and I already have some updates in mind :wink:

GitHub

GitHub

On Bolt’s GitHub we encourage all developers to use the issues and the discussion sections. Please post you issues in the issues tab and all Q&A’s, feature requests, etc. in the discussions section.

Important when using GitHub. Make sure to make all files in requires a child of Bolt.lua.


Please feel free to leave suggestions as to what I should add. It would really help. If you would like to support this project feel free to visit ICrann | Donate

Thank you everyone for showing your interest in the project :+1:

18 Likes

The majority of these methods are just single/double-line wrappers.


image

5 Likes

True, but there are also features like Bolt.Shoot() which includes and entire raycasting script and damage in one function.

As I also stated I want to make a lot more features but I just wanted to publish this to the public and keep updating it. I especially want to start working on functions sending back returns

Then you should remove the one-liner wrappers and stick to making longer, more useful functions like Bolt.Shoot(). Just because the wrapped method is shorter to type does not make it better - it wastes memory and the speed suffers.

Example:

function Bolt:ChangeTeam(player, team)
    player.Team = team
end

Luau has to waste memory storing the ChangeTeam function and in terms of speed it has to first execute the function’s body, and then executes the actual team changing.

3 Likes

I edited my topic in response to your reply’s to point out the possible performance impacts of using Bolt infrequently in your project and only for single line to double line tasks.

1 Like

I don’t really see the point of this, since you could just implement these functions yourself.

6 Likes

This just seems like codesmell. Shoving a bunch of unrelated functions in a single module is not clean.

For example, Gun.Shoot() would be much more defined and cleaner than Bolt.Shoot(). Seems ok for prototyping but will make your code messy in the future.

An other thing I want to point out is the redundant functions, for example example, Player.Team = Team is much easier and cleaner than Bolt:ChangeTeam(Player, Team).

7 Likes

The point of this is so you don’t have to do it yourself.

If I wanted it to be Gun.Shoot() you would have to rename the variable from Bolt to Gun. However if you wanted to do Bolt.NewLeaderstat() it would also change to Gun.NewLeaderstat(). If you wanted you could impliment this by changing this line of code
local Bolt = require(game:GetService("ReplicatedStorage"):WaitForChild("Bolt"))
to this:
local Gun = require(game:GetService("ReplicatedStorage"):WaitForChild("Bolt"))

I mean you could just do Gun.Shoot = Bolt.Shoot. But my point is you would need to override that function anyways, as you would probably want some extra behavior when the gun shoots.

Like this:

Gun.Shoot = function(Player,  Origin, MousPos, damage, distance)
-- any other effects, ect.
Bolt.Shoot(Player, Origin, MousePos, damage, distance)
end

At that point it would be much cleaner to put the actual behavior of the shooting in the gun.Shoot() function by redefining it

(Also you would want Bolt to automatically detect the player, since what’s the point if you have to do a raycast again to find which player the gun is pointing at).

I like the idea of this module, but maybe a module isn’t the best way to achieve this? Maybe like a plugin where you can drag and drop snippets of code used a lot like the player.Team thing.

Use dictionaries.

ModuleScript:

local bolt = {}
bolt.Gun = {}

function bolt.Gun.Shoot() 
    -- function's code here 
end) 
1 Like

I don’t find it necessary yet because the library isn’t that big yet.

Oh it’s not for performance but just for organisation

2 Likes

Ye what I meant was there wasn’t enough gun features yet to use dictionaries. To be honest I had totally forgot they existed. Thanks for the recommendations to add these. I will look into it.

1 Like

I would recommend splitting the different dictionaries into different scripts. You can use the Bolt.lua file as a collection of all those different scripts and expose miscellaneous functions (or you could use a “common” or another word for commonly used functions or ungroupable functions). I’ll make a pull request which splits up your current code on GitHub.

1 Like

This is a cool module, but it seems like it’s not a contribution the community particularly enjoys. Either way, thanks for the contribution.

3 Likes

Bolt 22.1.0

Bolt 22.1.0 has been released just now.

Change Log

  • Added checking ownership of game passes
  • Prompting purchases of game passes now returns true if the player bought them
  • Added RayCasting
  • Added MoveCamera
  • Removed place ID saving temporarily due to issues

RobloxWebsiteGitHub

The purpose of this post was for @icrann to share his creation, not to get comments on how his contributions are bad or nobody likes them. Is it the best library? No. But all he’s trying to do is help our tiresome hands.

3 Likes

I know, that’s why I thanked him for the contribution.

1 Like

Thanking him for the contribution then saying it’s useless to the community?