I thought it would be a good idea for people to post bad practices that we see in lua a lot that make inefficient code
maybe someone will actually read this thread and use it to better their coding!
declaring all of your variables at the beginning of a function, even though the function might return before that variable is used!
people should keep in mind that Lua’s memory management is rather slowww
local len = string.len(name)
local low = string.lower(name)
if len > 20 then
return false --well now we don’t need low, their name’s too long
–low should be defined here, after we’ve made sure their name isn’t too long
– insert some check for allowed characters, using the variable ‘low’