Jump to content

String > Bool


Recommended Posts

Posted

Как текстовое значение превратить в логическое (true / false)?

"true" = true

"false" = false

Я лишь знаю tonumber, tostring, tocolor, а tobool есть? :D

Sorry for my bad english! :)

Posted

Стандартной функции нет?

Мне надо из текста сделать логическое выражение.

Чтобы "true", стало true

if v == "true" then

return true

elseif v == "false then

return false

end

return v

Sorry for my bad english! :)

Posted

я же написал функцию, делает почти то же самое.

а стандартной нет.

?

  • Moderators
Posted

if v == "true" then

return true

elseif v == "false" then

return false

end

return v

" - Забыл

Developers, Developers, Developers, Developers.... © Steve Balmer

http://www.lua.org/about.html

Quote
Please do not write it as "LUA", which is both ugly and confusing, because then it becomes an acronym with different meanings for different people. So, please, write "Lua" right!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...