• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Gesior 2012 Parse Error?

Loth Gena

Roxeria 8.60 Developer
Joined
Feb 5, 2014
Messages
245
Reaction score
23
Location
UK
Hello, i had a working gesior 2012 website for my tfs 0.2, then i went to change some settings to make my server status work and sms shop work.

After i fixed it everything worked fine, the website worked fine, then suddenly i went on it again and i get this error:

HTML:
Parse error: syntax error, unexpected ':', expecting ';' in P:\xampp\htdocs\classes\configlua.php(56) : eval()'d code on line 1

I opened up configlua.php and here are the first 3 lines of the code:

PHP:
<?php
if(!defined('INITIALIZED'))
    exit;
 
Hello, i had a working gesior 2012 website for my tfs 0.2, then i went to change some settings to make my server status work and sms shop work.

After i fixed it everything worked fine, the website worked fine, then suddenly i went on it again and i get this error:

HTML:
Parse error: syntax error, unexpected ':', expecting ';' in P:\xampp\htdocs\classes\configlua.php(56) : eval()'d code on line 1

I opened up configlua.php and here are the first 3 lines of the code:

PHP:
<?php
if(!defined('INITIALIZED'))
    exit;
Show us configlua.php
 
Grr! looks like my server has gone to crap too! i just tried to run my server and i get an error saying unable to load config.lua, but its there?
 
Solved! i replaced config.lua of my tfs and everything seems to be fixed, website works again! no idea what caused it
 
Parse error: syntax error, unexpected '--' (T_DEC), expecting ';' in C:\xampp\htdocs\classes\configlua.php(45) : eval()'d code on line 1

help me
 
Parse error: syntax error, unexpected '--' (T_DEC), expecting ';' in C:\xampp\htdocs\classes\configlua.php(45) : eval()'d code on line 1

help me
Which part of the sentence is unknown to you? The one saying that you have unexpected "--' in your configlua or the one saying that ";" is expected?
 
If you can, please help

<?php
if (!defined('INITIALIZED'))
exit;

// NOT SAFE CLASS, LUA CONFIG CAN BE EXECUTED AS PHP CODE
class ConfigLUA
{
private $config;

public function __construct($path = false)
{
if ($path)
$this->loadFromFile($path);
}

public function loadFromFile($path)
{
if (Website::fileExists($path)) {
$content = Website::getFileContents($path);
$this->loadFromString($content);
} else {
throw new InvalidArgumentException('#C-2 LUA config file doesn\'t exist. Path: <b>' . $path . '</b>');
}
}

public function loadFromString($string)
{
$lines = explode("\n", $string);
if (count($lines) > 0)
foreach ($lines as $ln => $line) {
$tmp_exp = explode('=', $line, 2);
if (count($tmp_exp) >= 2) {
$key = trim($tmp_exp[0]);
if (substr($key, 0, 2) != '--') {
$value = trim($tmp_exp[1]);
if (is_numeric($value))
$this->config[$key] = (float) $value;
elseif (in_array(substr($value, 0, 1), array("'", '"')) && in_array(substr($value, -1, 1), array("'", '"')))
$this->config[$key] = (string) substr(substr($value, 1), 0, -1);
elseif (in_array($value, array('true', 'false')))
$this->config[$key] = ($value == 'true') ? true : false;
else {
foreach ($this->config as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull
$value = str_replace($tmp_key, $tmp_value, $value);
$ret = @eval("return $value;");
if ((string) $ret == '') // = parser error
{
throw new RuntimeException('#C-1 - Line <b>' . ($ln + 1) . '</b> of LUA config file is not valid [key: <b>' . $key . '</b>]');
}
$this->config[$key] = $ret;
}
}
}
}
}

public function fileExists($path)
{
return Website::fileExists($path);
}

public function getValue($key)
{
if (isset($this->config[$key]))
return $this->config[$key];
else
throw new RuntimeException('#C-3 Config key <b>' . $key . '</b> doesn\'t exist.');
}

public function isSetKey($key)
{
return isset($this->config[$key]);
}

public function getConfig()
{
return $this->config;
}
}
 
Parse error: syntax error, unexpected '--' (T_DEC), expecting ';' in C:\xampp\htdocs\classes\configlua.php(45) : eval()'d code on line 1

help me
It's problem with config.lua of OTS. There is probably Lua comment (--) in line with config ex.:
LUA:
redSkullTime = 24 * 60 * 60 -- time in seconds
Code above won't work in acc. maker. You must remove -- time in seconds part.

This is fine:
LUA:
-- time in seconds
This is fine:
LUA:
redSkullTime = 24 * 60 * 60
but both in same line makes acc. maker fail to parse Lua config, as it's not using any library to parse Lua. It just does some 'string replace' to convert Lua to PHP and then loads it as PHP.
 
Last edited:
It's problem with config.lua of OTS. There is probably Lua comment (--) in line with config ex.:
LUA:
redSkullTime = 24 * 60 * 60 -- time in seconds
Code above won't work in acc. maker. You must remove -- time in seconds part.

This is fine:
LUA:
-- time in seconds
This is fine:
LUA:
redSkullTime = 24 * 60 * 60
but both in same line makes acc. maker fail to parse Lua config, as it's not using any library to parse Lua. It just does some 'string replace' to convert Lua to PHP and then loads it as PHP.

I'm using tfs 1.5, with the Nakjila layout, but I have the same error, and even removing all the comments from my ot's lua config, the error persists. help me?
 
I know it's several years later, however, to fix this issue you have to go to the forgottenserver and go to the ULA File called "config.lua". Open that file with Notepad++ and change lines 122 through 133 with "--" in front of all text. has to be exactly this way or it won't work:

-- Experience stages
-- NOTE: to use a flat experience multiplier, set experienceStages to nil
-- minlevel and multiplier are MANDATORY
-- maxlevel is OPTIONAL, but is considered infinite by default
-- to disable stages, create a stage with minlevel 1 and no maxlevel
-- experienceStages = {
-- { minlevel = 1, maxlevel = 8, multiplier = 7 },
-- { minlevel = 9, maxlevel = 20, multiplier = 6 },
-- { minlevel = 21, maxlevel = 50, multiplier = 5 },
-- { minlevel = 51, maxlevel = 100, multiplier = 4 },
-- { minlevel = 101, multiplier = 3 }
-- }

This code fixed the isue for

XAMPP\htdocs\classes\configlua.php(56) : eval()'d code on line 1

to find this issue I used the code


$value = str_replace($tmp_key, $tmp_value, $value);
var_dump($value);

in the "XAMPP\htdocs\classes\configlua.php" file using Notepad++

this is the code before


{
foreach($this->config as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull
$ret = @eval("return $value;");
if((string) $ret == '') // = parser error
{

this is after
{
foreach($this->config as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull
$value = str_replace($tmp_key, $tmp_value, $value);
var_dump($value);
$ret = @eval("return $value;");
if((string) $ret == '') // = parser error
{

Should be noted that I also changed in the forgottenserver file "config.lua.dist" to "config.lua".

I hope this helped someone... took me a while to figure out where the code was searching....
 
Back
Top