there's an else after return 0 that's hiding from you. Might not be formatted correctly, but I'm unused to how Lua handles if then else statements and didn't know where to put it >_<