Skip to content
LotuxPunk edited this page Jan 29, 2019 · 5 revisions

JavaException => String cannot be cast as Double (Or something like that)

You probably do an io.read() or event.pull("chat_message") to get an information. So, in LUA when you do a read you gonna get a string value. You have to convert your variable to a number.

//OpenComputers
local stringValue = event.pull("chat_message")
//Computercraft
local stringValue = io.read() // for example "5"
//Cast the string to number
local numberValue = tonumber(stringValue) // "5" is converted to 5

Clone this wiki locally