ID:2619459
 
BYOND Version:513
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 81.0
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Numbers can be multiplied by strings.
Strings cannot be multiplier by numbers.
Strings cannot be compared to numbers.

The first seems like a bug compared to the other behaviour.

Numbered Steps to Reproduce Problem:
1. Take a string.
2. Take a number.
3a. string * number
4a. Runtime.
3b. number * string
4b. Result is 0.

Code Snippet (if applicable) to Reproduce Problem:
/proc/main()
var/text = "hi"
var/number = 4
world.log << (number * text)
world.log << (text * number)


Expected Results:
Everything runtimes.

Actual Results:
number * text evaluates to 0

Workarounds:
Try not to multiply numbers by text.
Intriguing. Also, if you divide instead, the result is the same number:

world << 4 / "something"

//the result is 4


Furthermore, you can divide in the other direction:

world << "something" / 4

//ouputs 1.35926e-043


I was wondering if this had anything to do with color math, as if DS was expecting the string to be a color, but I tried using "#FFF" and it didn't seem to affect the result.


EDIT: And another thing. If you try addition or subtraction, as in "something" + 4, it gives the runtime error "type mismatch." However, doing "something" * 4 will instead give the error "undefined operation"