piotrulos / MSCModLoader

ModLoader for My Summer Car
GNU General Public License v3.0
113 stars 57 forks source link

Add an Example for Settings.AddSlider Method (Mod, Settings, Single, Single) #117

Closed Aberro closed 4 years ago

Aberro commented 4 years ago

Please add an example for Settings.AddSlider Method (Mod, Settings, Single, Single).

TODO (optional): How to cast setting value to float or int?

Help Topic: http://my-summer-car.ml/docs/html/M_MSCLoader_Settings_AddSlider_1.htm

piotrulos commented 4 years ago

This is just regular c# stuff, check Convert.ToFloat or Convert.ToInt32

Aberro commented 4 years ago

Well, I've tried direct cast, but it didn't worked, and I didn't figured out what type it was.

piotrulos commented 4 years ago

cast will not always work in object type, because it can be anything. make value ToString() and use Convert class it's more reliable.

Aberro commented 4 years ago

Yes, but much much worse from performance point of view (at least for string), unlike cast. Anyway, I've created this issue to ask to clarify such moment in docs, would it be convert, or cast, or anything.