Need help getting tables to work.

Started by ComputerCrafter, Apr 13, 2024, 03:07 AM

Previous topic - Next topic

Which idea should I use to check if a character is matched?

LOTS of If Statements
0 (0%)
If Statements with Functions
0 (0%)
Use custom Table API
1 (100%)
Use different methods than above
0 (0%)
Use Variables instead of Tables
0 (0%)

Total Members Voted: 1

I was trying to make a character guessing game...but it didn't go so well.
The goal was to have a table-config system where you can add custom characters and prompts.

I couldn't make it work because the wiki site was down, and finding a way to check the table prompts was too hard.

I hope some more well-versed coders here can help me solve my problem! :)
I've already tried using variables, and using if statements (that's going to be very hard because of the sheer number of characters), and they didn't work.

Likewise, I added a poll if you want to vote for different ideas on how to solve these problems.

martsadas

local letters = {'a', 'c', 'e', 'f', 'm', 'o', 'p', 'r', 't', 'u'}

local function guess(letter)
    -- not not converts it to a bool

    return not not table.concat(letters):find(letter)
end
No signature set.