Jump to content

Two bugs about obse


Recommended Posts

First:

 

int iLength

string_var strTest

 

let strTest := "%e"

let iLength := sv_Length strTest

 

the iLength is 2 but 0. this is strange~~~

and,

 

let strTest += "Test"

let iResult := sv_Compare "Test"

 

The "iResult" is not 0.

 

And,

let strTest := "%e"

let iResult := sv_Compare "%e" strTest

 

The "iResult" is not 0, too.

 

The only way to test a empty string I have found is that: "sv_Compare $stringForTest stringForTest != 0"

Only for empty string, this exper is true.

 

 

Second:

 

let arArr := ar_Map "a":1 "b":2 "c":3

ForEach arIter <- arArr

let strKey := arIter["key"]

ar_Erase arArr strKey

Loop

 

Only element "a":1 will be deleted.

It is said that loop is executed only once.

The correct way to do this is that:

 

let iIdx := 0

let iSize := ar_Size arArr

if iSize > 0

let strKey := ar_First arArr

while iIdx < iSize

let strNext := ar_Next arArr strKey

ar_Erase arArr strKey

let strKey := strNext

let iIdx += 1

loop

endif

Link to comment
Share on other sites

int iLength

string_var strTest

 

let strTest := "%e"

let iLength := sv_Length strTest

 

the iLength is 2 but 0. this is strange~~~

and,

 

It is correct. "%e" only translates as "" when used as a format string

 

 

let strTest += "Test"

let iResult := sv_Compare "Test"

 

The "iResult" is not 0.

"let strTest += "Test"" should be " let strTest := "Test"

 

 

 

let strTest := "%e"

let iResult := sv_Compare "%e" strTest

 

The "iResult" is not 0, too.

let strTest := ""

let iResult := sv_Compare "%e" strTest

 

Returns 0, as "%e', now is a format string and is equal to strTest (="")

 

 

 

The only way to test a empty string I have found is that: "sv_Compare $stringForTest stringForTest != 0"

Only for empty string, this exper is true.

if eval strTest == "" ; works

 

 

let arArr := ar_Map "a":1 "b":2 "c":3

ForEach arIter <- arArr

let strKey := arIter["key"]

ar_Erase arArr strKey

Loop

 

I think scruggsy said this should work but, as you said, it does not.

I will try to find his comment in the OBSE forum.

 

Clarified with scruggsy and added to the WIKI

Edited by QQuix
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...