Forum Replies Created
- 
		AuthorPosts
 - 
		
			
				
The only thing I can see that might affect it is the callback char_t params are defined as PTR PTR. Just a guess, only started playing with Monkey2 the other day and this is all new to me.
Monkey1Function sqlite3_exec:Int( sqlite3 Ptr, sql:CString, callback:Int( Void Ptr, Int, libc.char_t Ptr Ptr, libc.char_t Ptr Ptr ), Void Ptr, errmsg:libc.char_t Ptr Ptr )An interface allows you to add specific functionality to any class, avoiding deep/complex class hierarchies. You can store instances of any class that implement the same interface in a collection and invoke any of the interface methods.
Sorry if that makes no sense, I’m not the best at explaining things. Here’s a quick untested example:
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445#Import "<std>"Using std.collectionsInterface IDrawableMethod Draw : Void()End InterfaceClass Dog Implements IDrawableMethod Draw : Void()Print "Draw a dog"End MethodEnd ClassClass Button Implements IDrawableMethod Draw : Void()Print "Draw a button"End MethodEnd ClassFunction Main()Local dog : Dog = New Dog()Local btn : Button = New Button()Local drawList : List< IDrawable > = New List< IDrawable >()drawList.AddLast( dog )drawList.AddLast( btn )For Local this : IDrawable = Eachin drawListthis.Draw()NextEnd FunctionFebruary 21, 2019 at 10:41 am in reply to: Fist class function in collection with struct parameter #16079Thanks Danilo, it didn’t occur to me to look at the C++ code. I’ll report the bug now.
Thanks, its good to be back!
I don’t think I would have had the patience to figure it out if it wasn’t for those lovely red squiggly lines, allowed me to try lots of different combinations until it worked… although I discovered later on with variants that no squiggles doesn’t mean it will actually run
OK after some more tinkering I have figured it out
Struct Test<T> Where T = Int Or T = Float
Constrains generics like it says in the help file, pretty handy for things like Vec2
 - 
		AuthorPosts