Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow arrayset to accept any type #516

Merged
merged 1 commit into from
Aug 20, 2018
Merged

allow arrayset to accept any type #516

merged 1 commit into from
Aug 20, 2018

Conversation

justgo97
Copy link
Contributor

@justgo97 justgo97 commented Aug 15, 2018

example of use case :

#include <amxmodx>

new Float:g_FloatArray[33]

public plugin_init( )
{
    register_plugin( "arrayset", "0.0.1", "JustGo" )

    for( new i = 1; i <= 32; i++ )
    {
        g_FloatArray[i] = random_float(1.0, 9.0)
        server_print( "g_FloatArray[%d]=%f", i, g_FloatArray[i] )
    }

    register_concmd( "amx_arrayset", "cmd_arrayset")
}

public cmd_arrayset( )
{
    arrayset( g_FloatArray, 0.0, sizeof(g_FloatArray) )

    for( new i = 1; i <= 32; i++ )
    {
        server_print( "g_FloatArray[%d]=%f", i, g_FloatArray[i] )
    }
}

@voed
Copy link
Contributor

voed commented Aug 15, 2018

Its gonna break a tag, isn't it?

@WPMGPRoSToTeMa
Copy link
Contributor

@voed what do you mean?

@voed
Copy link
Contributor

voed commented Aug 16, 2018

@WPMGPRoSToTeMa i mean SomeTag:somearray[] after arrayset will be any:somearray[], or not?🤔

@rsKliPPy
Copy link
Contributor

That's not how it works.

@justgo97
Copy link
Contributor Author

justgo97 commented Aug 16, 2018

@voed the any: tag means it can accept any type, in the past arrayset will give you a tag mismatch with Float, bool...ect and now that will not happen

@voed
Copy link
Contributor

voed commented Aug 16, 2018

Ok, nvm
Thanks

@Arkshine
Copy link
Member

Should be fine.

@Arkshine Arkshine merged commit 05b7411 into alliedmodders:master Aug 20, 2018
@AdamRichard21st
Copy link
Contributor

Sorry about posting in a merged request, but, I got a short question about arraysets.
How about making it possible to arrayset multidimensional arrays?

OciXCrom pushed a commit to OciXCrom/amxmodx that referenced this pull request Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants