Why is undo.GetTable() Local?

http://luabin.foszor.com/code/lua/includes/modules/undo.lua

I would like to use undo.GetTable() clientside, but I will have to use a hacky way to actually get this table. I’m not into using a hacky method.

Both on client AND the server GetTable is a local function.
However, this function is not used in undo.lua, undo.lua uses the PlayerUndo and the ClientUndos table.

It doesn’t make any sense. Why is this function local, it’s useless this way.
Garry: Please remove the “local” on line 22 and 181.

**(You


don't

have to provide me ways to get the table, that’s not what this thread is about)**

Fuck. Wrote out a solution, and then read the last line of your post.

Meh, here it is anyway. Give me a few boxes if you want.

[lua]
function debug.getupvalues(f)
local t, i, k, v = {}, 1, debug.getupvalue(f, 1)
while k do
t[k] = v
i = i+1
k,v = debug.getupvalue(f, i)
end
return t
end
[/lua]

[lua]
PrintTable(debug.getupvalues(undo.MakeUIDirty))
[/lua]

Up values are the locals used within a function.

I’ll make it bold :downs:

Edit:
garrynewman: @FPtje to stop people messing with it
This doesn’t make sense, why shouldn’t we be allowed to mess with the undo table?

Maybe cause it could screw up?

You should not have a computer, it could screw up.

You shouldn’t be alive, you could screw up!

The lot of you stop it and help the OP.
Personally though, I have no clue.

Deco’s function should work, and garry doesn’t want to fix it. I don’t know how we can assist further.

Well technically they’re helping by flawing what Garry said.
But as Dave just said, the only thing that can really happen now is to just use the function that whatshisface posted.

It doesn’t work as the function he’s trying to get the upvalues from is local too.

ClientUndos is a local, and it’s re-declared in that function, so I think it should work.

You don’t get it.
the function deco is trying to access is


LOCAL

One can not access a local function outside its scope

Deco is trying to access undo.AddUndo, which I’m pretty sure is global. ClientUndos is redefined in that function.

have a box.

Thanks. I’d rather have a book with a sign on it though. I do wonder how I missed that.

Should be able to access it via the undo module anyway.

Opps. I just grabbed the first function I saw.

Fixed!

Still won’t work though.

Please explain.