Y Generation
Apps
iPhone/iPad
NPB Statistics NPB Stats and Info
Mac OS X
RulingScreen Chinese Memorization Hey, More Apps will be released!
Contact About Y Generation
&nbps;Home ✈️ Travel ⚾ Baseball 🛠 Tech 📘 Language 👨🏻 Politics About Y Generation  😈
  • Travel✈️
  • Baseball⚾️
  • Tech🛠
  • Language📘
  • Politics👨🏻
  • 👩🏼‍💻Tech Note

lua

A collection of 1 post

👩🏼‍💻 tech-note

How to check if an element is in the table in Lua?

This is NOT supported in Lua. So you must write your own function manually. In Python, you can write the following: if i in yourList: In L

This is NOT supported in Lua. So you must write your own function manually.

In Python, you can write the following:

if i in yourList:

In Lua, write the following:

local function has_value(tab, val)
    for index, value in ipairs(tab) do
        if value == val then
            return true
        end
    end

    return false
end

And then, use the function to

-->
  • Y Generation
1 min read
Y Generation © 2021
Latest Posts 🙈🙉🙊