View Single Post
  #24  
Old 08-22-2014, 01:25 AM
Restraint Restraint is offline
NaS
Join Date: Jan 2014
Posts: 21
Restraint will become famous soon enough
Quote:
Originally Posted by Jakov_the_Jakovasaur View Post
just found that the bug with attr values starting with a number also applies to when doing:

Graal Script Code:
GuiShowImgCtrl.actor.attr[index] = "1_OtherRandomChars"
i dont know who there is that can fix it now, but it should be fixed
I reported this a long time ago, when I ran into this situation with an account of mine ("100Zero100") getting passed server-to-client seemingly as "100"

The problem involves datatyping.

Although Graal does not have explicit datatypes, it does have IMPLICIT datatypes, which can be grabbed or corrected by using @.

For example:

Graal Script Code:
temp.nil;
temp."";
if (
== b) { // true
if (@== @b) { // false 
The former is true because null int and null string are the same when they're just "blob" datatypes. The latter is false because null int and null string are not the same when their datatype is invoked!

To fix your problem, simply put an @ before the attr.

Example:

Graal Script Code:
function onCreated() {
 
this.attr[5] = "100Zero100";
}
//#CLIENTSIDE
function onCreated() {
 
sleep(1);
 
this.chat this.attr[5];

Chat sets to: 100

Graal Script Code:
function onCreated() {
 
this.attr[5] = "100Zero100";
}
//#CLIENTSIDE
function onCreated() {
 
sleep(1);
 
this.chat = @this.attr[5];

Chat sets to: 100Zero100

Hope that helps to shed some light and resolve these types of bugs.
Reply With Quote