Retrieve a value in config.txt

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
BonScott
Developers
Developers
Posts: 32
Joined: 08 Aug 2008, 15:35
Noob?: No

Retrieve a value in config.txt

#1 Post by BonScott »

Well... i need retrieve a value of specific key, created by me in config.txt... BUT, in normal plugin I don't have sucess. So I decided create a simple "hello world" plugin and test this.

Code: Select all

package testPort;

use Plugins;
use Settings;
use strict;
use Globals;
use Log qw(warning message error);

my $port = $config{'webPort'};

print "$config{webPort}\n";
warning "A webport: ".$config{webPort}."\n";

1;
in config.txt have one line with:

Code: Select all

webport 1020
In console show only;

Code: Select all

     #blank line
A webport:
How I can correct this ?
for um openKore more powerfull!

iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG
Contact:

Re: Retrieve a value in config.txt

#2 Post by iMikeLance »

%config is not yet filled with config.txt data while plugins are being loaded.

BonScott
Developers
Developers
Posts: 32
Joined: 08 Aug 2008, 15:35
Noob?: No

Re: Retrieve a value in config.txt

#3 Post by BonScott »

Resolved:

Code: Select all

my $port 

sub post_loading {
$port = $config{webPort};
}
Thanks to iMikeLance.
for um openKore more powerfull!

Locked