diff --git a/quest_api.lua b/quest_api.lua index 042263b..74a7177 100644 --- a/quest_api.lua +++ b/quest_api.lua @@ -138,8 +138,20 @@ yl_speak_up.get_quest_variables = function(pname, has_write_access) table.insert(liste, k) end end + else + local right = "read_access" + if(has_write_access) then + right = "write_access" + end + -- insert those vars owned by other players where this one has access + for k, v in pairs(yl_speak_up.player_vars) do + if( k[ "$META$"] + and k[ "$META$"][ right ] + and k[ "$META$"][ right ][ pname ]) then + table.insert(liste, k) + end + end end - -- TODO: insert those vars owned by other players where this one has read access to table.sort(liste) return liste end @@ -489,6 +501,9 @@ end -- does the opposite of the function above; adds "$ PNAME " if needed yl_speak_up.add_pname_to_var = function(var_name, pname) + if(not(var_name)) then + return "" + end local parts = string.split(var_name, " ") if(parts and parts[1] and parts[1] ~= "$") then return "$ "..tostring(pname).." "..tostring(var_name)