Page 1 of 1

[0.15.25] surface.create_entity{variation=...} zero based

Posted: Fri Jun 30, 2017 2:47 pm
by gheift
Hi,

if a entity is created with

Code: Select all

local entity = surface.create_entity{variation=...}
variation is started at 0. Changing it later with

Code: Select all

entity.graphics_variation=...
variation is started at 1.

Additionally one is able to assign values from 0 to 255 (inclusive) to variation in create_entity, but values from 0 to 65535 (inclusive) to graphics_variation.

Kind regards,
Gerhard

Re: [0.15.25] surface.create_entity{variation=...} zero based

Posted: Fri Jun 30, 2017 2:59 pm
by Rseding91
Thanks for the report. I've changed it so variation in create_entity is 1 based to match the API.

As for the allowed values: it internally down-converts the given value to 0-255 after converting it from 1 based to 0 based. Adding error handling when it's not within that range doesn't seem worth the time it would take since functionally it would be the same.

Re: [0.15.25] surface.create_entity{variation=...} zero based

Posted: Fri Jun 30, 2017 6:46 pm
by gheift
Rseding91 wrote:Thanks for the report. I've changed it so variation in create_entity is 1 based to match the API.

As for the allowed values: it internally down-converts the given value to 0-255 after converting it from 1 based to 0 based. Adding error handling when it's not within that range doesn't seem worth the time it would take since functionally it would be the same.
Thanks for fixing. There is already error handling in place (at least I threw errors in both cases), so I do not understand that you don't want to add handling if its already there.

Kind regards,
Gerhard