Fire Emblem Heroes Wiki
Fire Emblem Heroes Wiki
Template-info.svg Documentation

Test cases

Converts a case-insensitive string value to a boolean value. Exposes a single function, toboolean, which accepts a single argument, passes it through tostring, and returns either a boolean or nil:
  • The strings 0, no, and false return false.
  • The strings 1, yes, and true return true.
  • All other values return nil.

This module is the Lua counterpart of Template:Bool.

local BOOL_VALUES = {
	['0'] = false, ['no']  = false, ['false'] = false,
	['1'] = true,  ['yes'] = true,  ['true']  = true,

return {
	toboolean = function (x)
		return BOOL_VALUES[mw.ustring.lower(mw.text.trim(tostring(x), '%s'))]