Search found 932 matches

by Bugala
Tue Nov 24, 2020 11:55 am
Forum: General programming
Topic: Saving OOP using WriteTable loses Variables?
Replies: 0
Views: 9

Saving OOP using WriteTable loses Variables?

a test code: myOOP = {} Function myOOP:Create() o = {} SetMetaTable(o, self) self.__index = self o.varstosave = {} o.anothervar = 2 Return(o) EndFunction Function myOOP:Save() OpenFile(1, "ooptest.oop", #MODE_WRITE) WriteTable(1, self) CloseFile(1) EndFunction Function myOOP:Load() OpenFile(1, "oopt...
by Bugala
Mon Nov 23, 2020 5:58 pm
Forum: General programming
Topic: Saving OOP Object as Table, what to consider?
Replies: 5
Views: 76

Re: Saving OOP Object as Table, what to consider?

And I guess nothing else I need to take into consideration when Read/Writing OOP Table? At least I cant figure out anything else.
by Bugala
Mon Nov 23, 2020 12:59 pm
Forum: General programming
Topic: is it safe to catch only one VAR from return(a, b)?
Replies: 1
Views: 24

is it safe to catch only one VAR from return(a, b)?

I couldnt find this mentioned in documents, so here an example code: Function test() Local a = 1 Local b = 2 Return(a, b) EndFunction c = test() DebugPrint("c:"..c) Question is, is this a safe way to catch value of only "a" or should I always use something like: "c, d = test()" when returning two or...
by Bugala
Mon Nov 23, 2020 9:26 am
Forum: General programming
Topic: Saving OOP Object as Table, what to consider?
Replies: 5
Views: 76

Re: Saving OOP Object as Table, what to consider?

I figured out a way to get around the previous comments problem, change program 2 into this: TESTOOP = {} Function TESTOOP:Create() o = {} SetMetaTable(o, self) self.__index = self o.var = 2 Return(o) EndFunction Function TESTOOP.myfunc() DebugPrint("test") EndFunction OpenFile(1, "testoop.tbl", #MO...
by Bugala
Mon Nov 23, 2020 9:13 am
Forum: General programming
Topic: Saving OOP Object as Table, what to consider?
Replies: 5
Views: 76

Re: Saving OOP Object as Table, what to consider?

To demonstrate this better, here is example code. Program 1: TESTOOP = {} Function TESTOOP:Create() o = {} SetMetaTable(o, self) self.__index = self o.var = 2 Return(o) EndFunction Function TESTOOP.myfunc() DebugPrint("test") EndFunction a = TESTOOP:create() b = a:create() OpenFile(1, "testoop.tbl",...
by Bugala
Sun Nov 22, 2020 8:27 pm
Forum: General programming
Topic: Saving OOP Object as Table, what to consider?
Replies: 5
Views: 76

Re: Saving OOP Object as Table, what to consider?

And are there any way around these problems? Like could I somehow WriteTable/ReadTable both OOP as well as myoopobject tables and that way get it to work? As in if I normally save these both and then load them separately using ReadTable to another program as OOP and myoopobject, I suppose myoopobjec...
by Bugala
Sun Nov 22, 2020 8:21 pm
Forum: General programming
Topic: Saving OOP Object as Table, what to consider?
Replies: 5
Views: 76

Saving OOP Object as Table, what to consider?

While others can answer too, this question is mainly targeted at Andreas. I realised that by using WriteTable and ReadTable, I could save Object Oriented Programming Objects in Hollywood. However, I also realised it probably is not that simple and came to conclusion that instead of trying out myself...
by Bugala
Wed Nov 18, 2020 2:33 pm
Forum: Wishlist
Topic: MoveBrush with Transparency
Replies: 5
Views: 145

Re: MoveBrush with Transparency

If using Layers, you could first use: SetLayerTransparency(id, level) and then MoveBrush and afterwards again SetLayerTransparency to gain temporary transparency.

Or did I miss what you were after?
by Bugala
Tue Nov 10, 2020 11:11 am
Forum: Hollywood bugs
Topic: HaveItem doesnt find table["index name"] , bug or a feature?
Replies: 2
Views: 383

Re: HaveItem doesnt find table["index name"] , bug or a feature?

Might be a feature.

I investigated this issue more and noticed following.

table["Name"] = 1

cant be found using table.name, as example: b = table.name

However, if I use all small letters:

table["name"] = 1

then I can use b = table.name and it works.

And same with HaveItem() works fine too.
by Bugala
Tue Nov 10, 2020 10:53 am
Forum: Hollywood bugs
Topic: HaveItem doesnt find table["index name"] , bug or a feature?
Replies: 2
Views: 383

HaveItem doesnt find table["index name"] , bug or a feature?

example code: testtable = {} testtable["Movement Cost"] = 2 testtable[1] = 3 If HaveItem(testtable, 1) Then DebugPrint("1 is found") If HaveItem(testtable, "Movement Cost") Then DebugPrint("Movement Cost found") it prints "1 is found" as expected, but unexpectedly (to me at least), it doesnt print "...