Raised This Month: $ Target: $400
 0% 

KeyValues.KeyValues how to use ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nerus
Senior Member
Join Date: Aug 2010
Location: Poland
Old 03-31-2016 , 12:26   KeyValues.KeyValues how to use ?
Reply With Quote #1

Hi, like in title.

Example script:
PHP Code:
#pragma semicolon 1
#pragma newdecls required

public void CreateCfg()
{
    
KeyValues kv_root CreateKeyValues("root");

    
KeyValues kv_inside_root kv_root.KeyValues("inside"); <<-- Line 40

    KeyValuesToFile
(kv_root"test.cfg");

Quote:
test.sp(40) : error 035: argument type mismatch (argument 1)
test.sp(40) : warning 204: symbol is assigned a value that is never used: "kv_inside_root"
Test.cfg:
Quote:
"root"
{
"inside"
{
}
}
Nerus is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 03-31-2016 , 12:47   Re: KeyValues.KeyValues how to use ?
Reply With Quote #2

PHP Code:
KeyValues kv_root = new KeyValues("root"); //Compiler replaces with: KeyValues kv_root = KeyValues.KeyValues("root") 
is the same as:
PHP Code:
KeyValues kv_root CreateKeyValues("root"); 
to do what you want, you need another method(JumpToKey with create=true)

Last edited by WildCard65; 03-31-2016 at 12:49.
WildCard65 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode