#Challenge
1 messages · Page 1 of 1 (latest)
@severe steppe
You cannot overwrite or redefine 'table' **directly **or indirectly by any syntax.
modification isn't redefining?
yes
at the end values must be in the table
but you can't do table[3] = 2
and any local a = table a[3] = 2
can we modify __index?
that's metatable
local table = {};
-- v SOLUTION BELOW v ----------------------------------
local output = {
[1] = "Hello World",
[2] = 1,
[3] = 2,
[4] = 3
}
table.__index = function(self, key)
return output[key]
end
table.__len = function()
return 4
end
setmetatable(table, table)
-- ^ SOLUTION ABOVE ^ ----------------------------------
assert(table[3] == 2)
assert(table[4] == 3)
assert(table[2] == 1)
assert(#table == 4)
print(table[1])
this works but its cheeting
cheating*
no you are setting meta
yes cheating
yeah thats what he said

u gotta look for some debug code i guess
i think there is a way but not sure which function to use
youre just not supposed to recreate the table
all you gotta do is keep it the same table but different values
@mossy wolf is it intentional that real lua table is being shadowed
seems like a debug job
where
as solution?
you are not able to use table lib anyway
then just
table.insert(solution_table, "hello, world")
table.insert(<blablaba>
you cant use table lib
* You cannot use assignment (table[2] = 1), the table library, rawset or any other function to add values to the table.
'any other function to add to the table'
does it have something to do with chunks?
like wtf are you supposed to do
this is just a clever way
because the only thing i see is hijacking metatables but alas, you can't do that
very hacky
maybe
any other function to add values to the table. bro...
yeah
it clearly says any function that adds values is illegal
by redefining do you mean table = a
yes
ok
I think any 5.*
i assume setfenv'ing it is illegal because it technically redefines the table?
hm, actually challenge doesn't tell that, maybe yes it's valid
:S
the table is a local
ah indirectly
local table = {};
-- v SOLUTION BELOW v ----------------------------------
local output = {
[1] = "Hello World",
[2] = 1,
[3] = 2,
[4] = 3
}
debug.setlocal(1, 1, output)
-- ^ SOLUTION ABOVE ^ ----------------------------------
assert(table[3] == 2)
assert(table[4] == 3)
assert(table[2] == 1)
assert(#table == 4)
print(table[1])
like I'm guessing thats banned
yes
this is not a glua challenge
what kinda shit can u do with debug.setlocal?
set local variables
does this mean you could access the os.* lib within gmod?
no
bruh what
guessing some weird setupvalue shit would also not be allowed
yes you are redefining it indirectly
but using debug.setlocal is close
hmm
you can't set indices of a table with it can u?
plus that would break that one rule
you can but only in hacky way
hmm
ahah
I think I found it
well I can read it
hmm
setting it might be tricky
i will say in advance, in the end the code will assign values to that table, but not in the way you know
wtf
I just woke up and am meant to be doing school, but this mf is going to distract me for the whole 6 hours
basically asking @severe steppe
no I'm still looking
local _, val = debug.getlocal(1, 1)
val[1] = "Hi"
```still cheating?
yes
alright
I was trying some wack shit like this
local table = {};
-- v SOLUTION BELOW v ----------------------------------
local _, val = debug.getlocal(1, 1)
local h = val[1]
debug.setlocal(1, 4, 1)
-- ^ SOLUTION ABOVE ^ ----------------------------------
but I forgot its just a reference type
I warned that it's really doing table[3] = 2
but it just... doesn't use syntax you can make
@topaz wraith
local foo = { ({debug.setlocal(1, 2, table), "Hello, World!"})[2], 1, 2, 3 }
@flint gyro
oh wow
the rules are very strict though, they become confusing because this kind of looks like you're "redefining" the table
then its first key replaces index 2 to 1
yea its tough
You cannot use assignment,,,,
it's kind of directly in the bytecode but anyway
fair
When setlocal changes index 2 to 1, foo becomes table
table constructor continues to build up
and adds all values
i know the rules are not clear, I told the same to the author
Who is the author?
epic name
roblox exploiters
great
magnitudes worse than gmod exploiters like @flint gyro
||
||
0572 seems like he'd be a roblox exploiter too
E
why not just use select
local foo = {
select(2, debug.setlocal(1, 2, table), "Hello, World!"),
1, 2, 3
}
this works aswell
i really was thinking something like this like you create your own table and instantiating variables in it instead of adding values and set it to the expected table but idk why i couldn't think of the solution
no, i do not have autism
Prove it
NOOOO