Skip to content

why doesn't this code work #1318

@nate902011

Description

@nate902011

Describe your problem here.

im trying to make compatibility with the old judgeCountStrings.txt system and it doesn't work
here's the relevant code:

local function setupJudgeStrings(rType)
	--To add more quotes for your specific rating type, add a comma at the end of the last one, and add another field for your custom rating type. (Be sure to use your list.txt name!)
	local presets = {
   		["Default"] = {"Perfects","Sicks","Goods","Bads","Shits","Misses"},
   		["Doki Doki+"] = {"Very Dokis","Dokis","Goods","OKs","Nos","Misses"},
   		["FIRE IN THE HOLE"] = {"Easys","Normals","Hards","Harders","Insanes","Extreme Demon Fails"},
   		["NMCW"] = {"Amazings","Wows","Nices","Bruhs","Bee-womps","Misses"},
   		["TGT V4"] = {"Killers","Awesomes","Cools","Gays","Retardeds","Fails"},
   		["VS Impostor"] = {"Perfects","Sussys","Sus'","Sads","Asses","Misses"},
   		["Yeahs"] = {"Super Yeahs","Yeahs","Okays","Thin Ices","Nos","Super Nos"}
   	}
    local normalRating = 'ratings/'.. stringTrim(string.gsub(string.lower(getPropertyFromClass('ClientPrefs', 'ratingType')), ' ', '-')) ..'/' --pneumonoultramicroscopicsilicovolcanoconiosis

    local thetxtfile = 'images/'.. normalRating ..'judgeCountStrings.txt'
    if checkFileExists(thetxtfile) then
        judgeTxt = getTextFromFile(thetxtfile)
        for line in string.gmatch(judgeTxt, "([^\n]+)") do
            table.insert(compatibility, line)
        end
    end
    return presets[rType] or compatibility or presets["Default"]
end

function stringTrim(str)
    return string.gsub(str, "^%s*(.-)%s*$", "%1")
end

the normalRating part works (despite looking horrible), the getTextFromFile part finally worked this time (i checked), its the turning the string into the table part that fails to do anything and idk how to fix it. (yes, judgeCountStrings.txt is in the right location and works in 1.48.1)
heres the luaDebugMode lua trace:

Image

What version did the bug occur?

a few commits after v1.49.0 prerelease

Did you check if the problem occurs in the latest build?

None

Commit build or Release build?

Commit Build of latest version.

Did you check if there's a problem that you are trying to figure out on the issue linked below?

Yes

Did you check if there's any similar issues?

No

Are you modding a build from source or with Lua?

Lua

Command Prompt/Terminal logs/Crash logs (if existing)

No response

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions