• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] tag mismatch?
#11
(2019-05-01, 10:09 AM)Y_Less Wrote:
(2019-04-27, 09:53 AM)mr_sacrimoni Wrote:
(2019-04-27, 06:43 AM)Y_Less Wrote: `pinfo:id` must be an integer, rather than a float, but you are adding a float to it. ?That's the problem - you can only add an integer to a float if the result is also a float.



ID is a numerical representation of memory place inside of an enum.



For example if I have an enum:



PHP Code:
enum pInfo {

? ?
ID, (0)

? ?
Admin, (1)

? ?
Level, (2)

? ?
Float:Health (3)

}; 



pInfo:3 would hit Health, making it a float?



That's not how enums work. ?There's no run-time tag representation, so the VM doesn't know that `pinfo:3` is a float, nor does it know that `id` will be `3` and thus to use float operations. ?`Health` has tag `Float`, so if you explicitly use exactly that constant, the tags will work. ?Anything else and the tag information is lost.



I am aware of that, but the logic stands. Could I just cast 'pinfo:3' to float avoiding the warning that way?
  Reply


Messages In This Thread
tag mismatch? - by mr_sacrimoni - 2019-04-25, 02:07 PM
RE: tag mismatch? - by Ihnify - 2019-04-25, 05:51 PM
RE: tag mismatch? - by iSpark - 2019-04-25, 07:36 PM
RE: tag mismatch? - by mr_sacrimoni - 2019-04-25, 09:14 PM
RE: tag mismatch? - by hual - 2019-04-25, 09:26 PM
RE: tag mismatch? - by Y_Less - 2019-04-27, 06:43 AM
RE: tag mismatch? - by mr_sacrimoni - 2019-04-27, 09:53 AM
RE: tag mismatch? - by Y_Less - 2019-05-01, 10:09 AM
RE: tag mismatch? - by mr_sacrimoni - 2019-05-01, 04:54 PM
RE: tag mismatch? - by iSpark - 2019-04-27, 12:53 PM
RE: tag mismatch? - by mr_sacrimoni - 2019-04-28, 05:32 PM
RE: tag mismatch? - by Y_Less - 2019-05-02, 09:15 AM

Forum Jump: