Argonwolf Posted January 14, 2021 Share Posted January 14, 2021 I have a mod with a command that takes alphanumeric arguments. The command does different things depending on whether it was given a number or a letter string. What I'd like to know is how to convert (or try to convert) a string to a number so I can do this. I'd really like to not have two separate commands, but when i tried tonumber (a supposed Lua standard function) it crashed saying tonumber is a nil value. which I found extremely odd. Any help is much appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/126088-how-can-i-read-numeric-values-from-command-arguments/ Share on other sites More sharing options...
penguin0616 Posted January 14, 2021 Share Posted January 14, 2021 GLOBAL.tonumber 2 Link to comment https://forums.kleientertainment.com/forums/topic/126088-how-can-i-read-numeric-values-from-command-arguments/#findComment-1416433 Share on other sites More sharing options...
Argonwolf Posted January 14, 2021 Author Share Posted January 14, 2021 15 hours ago, penguin0616 said: GLOBAL.tonumber That worked, thank you. Link to comment https://forums.kleientertainment.com/forums/topic/126088-how-can-i-read-numeric-values-from-command-arguments/#findComment-1416687 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now