and if the function is called then run something before running the function
is there a _G lib that i can overwrite to accomplish this?
thanks for the help in advance.
maybe you could cycle through the _G library? i'm not sure how its possible, but maybe.
maybe you could cycle through the _G library? i'm not sure how its possible, but maybe.
thats exactly what i was thinking.
only problem is i dont know how or where the library is located
local function yourfunction()
--# do stuff
end
local function cycle(tbl)
for k,v in pairs(tbl) do
if type(v) == "function" then
tbl[k] = function() yourfunction() return v() end
elseif type(v) == "table" then
cycle(v)
end
end
end
cycle(_G)
_G won't help you if you truly want to cover "any" function. The CraftOS shell launches in a separate environment, and any scripts the user executes place their globals into that (as opposed to _G).
It'd be easy enough to get the desired environment table, but that still won't get you any variables the user defines as local to their scripts - and if the user's code is running, odds are you won't be able to do anything in between the time when they define and then execute new functions anyway!
So to me, the answer would be to load in their code as a string, alter it to do what you want it to do, then loadstring & pcall result.
But I suspect you're trying to hammer a square peg into a round hole here. You may be better off explaining what your actual end goal is, and asking how best to go about it.
If want to removed that, just either separate drawing and the calculations or use a buffer API._G won't help you if you truly want to cover "any" function. The CraftOS shell launches in a separate environment, and any scripts the user executes place their globals into that (as opposed to _G).
It'd be easy enough to get the desired environment table, but that still won't get you any variables the user defines as local to their scripts - and if the user's code is running, odds are you won't be able to do anything in between the time when they define and then execute new functions anyway!
So to me, the answer would be to load in their code as a string, alter it to do what you want it to do, then loadstring & pcall result.
But I suspect you're trying to hammer a square peg into a round hole here. You may be better off explaining what your actual end goal is, and asking how best to go about it.
ok im trying to make a no flicker api so before any function runs i was
to run term.current().setVisible(false)
then after i want to run
term.current().setVisible(true)
If want to removed that, just either separate drawing and the calculations or use a buffer API.
If want to removed that, just either separate drawing and the calculations or use a buffer API.
i want to make my OWN api
and i want it to automatically use no flicker when a function is called
that way theres no user input required.
ok im trying to make a no flicker api so before any function runs i was
to run term.current().setVisible(false)
then after i want to run
term.current().setVisible(true)