variable
can we create a variable which have a multi types?
I mean something like: Code:
new variable[3] |
Re: variable
As far as I know, this is not possible, since you can save only integer values in one cell of variable. For string you must have more cells, and for floats I think you have to use float() tag instead of Float:, because this is used when you create new variable.
|
Re: variable
Explain what you want to do and why.
|
Re: variable
I want have in one variable in this same time float and integer, like first post. Then i dont want to check that something variable is Float or Integer, i want to simple e.c use
Code:
set_task(variable[VALUE_OF_CVAR_TASK], "... ) |
Re: variable
For what good reason?
If you make it a float you can assign integers to it by using float() or just * 1.0 or vice versa with floatround() since money doesn't really have to be that exact. |
Re: variable
money is only example
What when i want to have specify float ? Like 1.5 :) Floatround will make to 1.0 or 2.0, dont know specialyy |
Re: variable
It depends. You can floor it, ceil it or round it. By default it's rounding, so that would be 2. Another option is to multiply it by, say 10, and then divide it by 10 on the other end. That way you don't lose information if you have to pass it through an array of some sort.
|
Re: variable
Thats good idea,thanks for help ;)
|
Re: variable
Why not use enums with different type?
|
Re: variable
because i have a gCvarInfo where are a returns of CvarRegister (cvar_util)
and someone from cvars is float so i cant enum float to CvarRegister xD and i must create a new enum tabel with value (integer or float) sry for my english |
| All times are GMT -4. The time now is 21:07. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.