Forum Replies Created
-
AuthorPosts
-
@druggedbunny Done in dev branch.
I also added “Copy path” action into tab menu and Project view.
Attachments:
Wow!
Cool!
- Open file locationlocation – it’s easy, will add.
- Irc chat – I ask Hezkore and Mark what to do with it before removing. But if it’s useful I can restore.
- Don’t know about unprofessional status of discord; I like it.
Notes:
-1*exp => -exp.
Monkey2 already have Pow() function in monkey.math.
Maybe you need fresher version of mx2cc to compile.
There is the miniz module.
And example of its usage here:
https://github.com/blitz-research/monkey2/blob/develop/modules/std/misc/zipfile.monkey2
Let me simplify code given above.
DataBuffer class has Load method – use it instead of FileStream etc.
Also there is a PeekString (for this example) and many other methods to operate with bytes in buffer – read docs of them.
My version:
Monkey123456789101112131415161718192021222324252627282930313233343536373839#Import "<std>"#Import "assets/"Using std..Class TestMethod New( path:String )bytes=DataBuffer.Load( path )Assert( bytes<>Null,"Can't load data from "+path+"!" )EndProperty Bytes:DataBuffer() ' make public read-only propertyReturn bytesEndPrivateField bytes:DataBufferEndFunction Main ()' first: place netepad.exe into /assets/ folder near this source fileLocal t := New Test( "asset::notepad.exe" )Local buf:=t.Bytes ' assign to local to use short variablePrint "Data buffer is " + buf.Length + " bytes"' Start of a Win32 executable is always "MZ" (for Mark Zbikowski, DOS developer!):Print buf.PeekString( 0,1 )Print buf.PeekString( 1,1 )EndMaybe std.memory.DataBuffer class is what you need.
Look at %monkey2%\modules\std\collections\container.monkey2.
There are base types, but they are fake – have no methods. So we cant use them as usual.
Also Array struct don’t implement IContainer.
So I don’t know how to achive universal processing of any collection.
Hi,
here is my localization system – https://github.com/engor/m2-localization
This is easy to use lightweight system that allow you
to keep all texts localized on-the-fly.I thought about converter.
I think such converter can be sold.
It is useful to be able to declare an abstract Class Function in order to enforce any derived classes to define the function (a style of contractual programming, I guess?). Certainly they make sense within an interface, don’t they?
‘Static’ mean that this logic is common for whole class/type, not for every instance.
To declare common logic for instances which can be overriden you should use virtual methods (not a functions).
To prevent overriding in derived classed you can mark methods as Final.
To force user to override method – mark it as Abstract; methods of interfaces are abstract by defaul.
My suggestion is good for a short improvements. But if you have long changes then there can be many merges of m2 repo in yours.
But anyway – the only main repo here is brl/monkey2, and to keep its commits clear Mark have to always use Squash&Merge option (to get single commit of all pulled changes). And I think he does it already.
You can’t override static methods in java or c#, so I think Mark have to deny it too.
-
AuthorPosts
