Jump to content




[Question] Math


  • You cannot reply to this topic
3 replies to this topic

#1 mibac138

  • Members
  • 132 posts
  • LocationPoland

Posted 13 February 2014 - 12:52 PM

Hello!

Is there a posibility to do math calculations in a string ? (ex. tArgs[1] = 12-2*2)

#2 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 13 February 2014 - 01:01 PM

It depends on what you call a string. In that example of yours

View Postmibac138, on 13 February 2014 - 12:52 PM, said:

tArgs[1] = 12-2*2
there are no strings at all. Give us a less foggy explanation of what you are trying to do.

#3 mibac138

  • Members
  • 132 posts
  • LocationPoland

Posted 13 February 2014 - 01:25 PM

Do something like a calculator - u give input (ex. "12-2*2") and it counts how much it is.

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 13 February 2014 - 01:32 PM

Yep, it's possible. The simplest way is to use loadstring. That will allow any executable Lua code to be run though, so it's probably a bad idea to use it if security matters in the least. There was another thread on this very recently that had some good information. Check that out as well.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users