vLua is a drop-in batteries-included replacement to loadstring without restricted or crippled functionality.
API
vLua is super simple to use! Add the Module into your Project, then require it, that’s it. Here’s an example:
local loadstring = require(script.Loadstring)
loadstring("print'hi'")()
function loadstring(BytecodeOrSource: string, Environment: table): function
Takes BytecodeOrSource, and returns a executable function. BytecodeOrSource must be vanilla Lua 5.1, it currently does not accept Luau at this time, although this is being worked on by various members of the community. Optionally, you can provide a custom Environment for the returned function with the second variable.
Does this support Luau?
Currently, vLua only supports Lua 5.1 and does not support Luau in any format at this time. Progress toward support is being made by the community however, and you can follow the progress by visiting the following GitHub repositories:
The event fires correctly but prints nil for every hit. I tried passing just a function name as the Connect parameter, but got the same results. The same thing happens with ClickDetector.MouseClick event The mouse click is supposed to return the player as a parameter, but it just comes back nil. Any advise?
SOLVED: Don’t fix the warning in FiOne about a table.move with index 0. Thought I would get rid of the script analysis warning and set it to 1. But don’t do it. Works perfectly fine with the warning.
Haven’t had a chance to actually test it, but took an initial look at this and wowie! That one large script! If you’re cool with it, I’ll take a crack at some point to break it down into various modules to make things a little more manageable, then integrate with vLua. I’d like add support for both vanilla Lua 5.1 and Luau some point down the road.
There is a reason this is a loadstring re-make. You can’t actually use it, other than that, you should never do what you want to do. Just get the module in game
Im making a system on github that makes it easier for new people to make games, and as a test i put the code on github to see if it works, once im done the normal loadstring methods ill start to implement the loadstring remake, you can go onto the github page and see how its going so far if you want lol, so thats why i dont want to just put the module in my game
I think its a very bad idea to use loadstring for this, the request could fail making your game not work, other than that, it’s bad practice to depend on something always being the way it is; an update to a certain part of the code could cause obscure issues, or in a different case; the script could just backdoor the game at any moment! The entire point of having the modules in your game is so that doesnt happen, and when neccessary; update manually.
thats fine, i could use pcall with a delay just in case, plus, nothing ive ever done has been appreciated by anyone (except maybe my parents) so the chances of anyone except me using the stuff is pretty low anyway