solution
print(lang.keys[data.key].perm)
Lang file
local lang = {
keys = {
mec_boss = {
title = "mec_boss",
perm = "mec.perm",
},
police_boss = {
title = "police_boss",
perm = "police.perm",
}
}
}
i want to be able to get the value like this
local test = "mec_boss"
print(lang.keys.(test).perm)
im so bad at describing this … im so sorry
local test = "mec_boss"
print(lang.keys[test].perm)
i tryed before gave same error
<name> expected near '['
Please show your whole code
vrp v2
RegisterNetEvent("jobs:server_perm")
AddEventHandler("jobs:server_perm", function(data)
local user = vRP.users_by_source[source]
print(lang.keys.[data.key].perm) -- error msg says this line ;P
if user:hasPermission(lang.keys.[data.key].perm) then
print("you hit me !")
end
TriggerClientEvent("print", source, "msg") -- ignore this
end)
the dot in data.key ?
local data_key = data.key
still same error
<name> expected near '['
ahh the . before [
print(lang.keys[data_key].perm)
this kinda worked thx @TheIndra