I am trying to replicate the Verbal Expression library for python in Genie as an exercise to learn how to use classes. I've got simple classes like the ones listed at the tutorial down, however when it comes to instatiate methods in a object oriented fashion I am running into problems. Here is what I am trying:
For training purposes I want a method called add that behaves identically as string.concat().
[indent=4]
class VerEx : Object
def add(strg:string) : string
return this.concat(strg)
But I get the error:
verbalexpressions.gs:33.16-33.26: error: The name `concat' does not exist in the context of `VerEx'
When I use a different approach, like:
class VerEx : Object
def add(strg:string) : string
a:string=""
a.concat(strg)
return a
init
test:string = "test"
sec:string = " + a bit more"
print test.VerEx.add(sec)
I get the error in the last line of the above text, with the warning:
verbalexpressions.gs:84.11-84.21: error: The name `VerEx' does not exist in the context of `string?'
I want to be able to make test.add(sec) behave identically to test.concat(sec), what can I do to achieve this?