04-19-2021, 09:43 PM
(This post was last modified: 04-19-2021, 09:51 PM by _XxFedexX_.)
(04-19-2021, 08:29 AM)NiLSPACE Wrote: It seems the link doesn't work unless you have adblock disabled.
Also, I see you're obfuscating the code (which is fine and entirely your choice), but it's actually possible to compile and distribute the Lua bytecode. If you've got Lua standalone installed it's as simple as this:
local args = {...} for idx, file in ipairs(args) do local f = loadfile(file); local dump = string.dump(f); local file = io.open(file .. "c", "wb"); file:write(dump); end
And then calling
Code:compile.lua AirMovements.lua FedeAC.lua KubeLib.lua PacketSpeed.lua Speed.lua
If you don't have the Lua standalone you could change the code to make Cuberite compile the files for you. You'd also have to change where the settings are stored though. There is a catch, Cuberite doesn't automatically load 'luac' files (though changing the extensions back to .lua should work) and there is no guarentee that the bytecode works if we ever upgrade Lua. However, as we've been using this version of Lua since 2011 I doubt that's a big problem.
EDIT:
Also, the isStairs function doesn't work. You have to compare the values to g every time. It might be better to put those values in a table and check if the variable g can be found inside it. These are magic numbers though which you might want to avoid.
The code is not obfuscated, it is just minified (if you run a LUA beautifier it'll became human-readable.) But THANKS i wanted to compile it! I am just wondering something: Will it work on evey OS and CPU? For example i am running Windows x86-64, but i am not sure that if i "compile" to bytecode it will work on other OS or on ARM.
EDIT: Cuberite is running LUA 5.1 right?
EDIT 2: When I try to convert to bytecode i get error:
Can't load plugin FedeAC because of a load error in file Plugins\FedeAC/AirMovements.lua: 3 (Plugins\FedeAC/AirMovements.lua: bad header in precompiled chunk)