banananas
banananas
Explore posts from servers
MModular
Created by Wouks on 10/26/2024 in #questions
Error when running Mojo when path contains # (hash)
i believe
13 replies
MModular
Created by Wouks on 10/26/2024 in #questions
Error when running Mojo when path contains # (hash)
That's... very strange indeed it may be a bug but i can't really go in deeper since magic isn't open-source
13 replies
MModular
Created by Wouks on 10/26/2024 in #questions
Error when running Mojo when path contains # (hash)
Honestly i'm not sure why this happens; usually if i rename the directory and rebuild i can go on without any issues
13 replies
MModular
Created by Wouks on 10/26/2024 in #questions
Error when running Mojo when path contains # (hash)
Tbh i've never used the modular cli so i'm not sure how that used to look
13 replies
MModular
Created by Wouks on 10/26/2024 in #questions
Error when running Mojo when path contains # (hash)
I'm pretty sure if you change the name of the folder in any way you have to rebuild the project iirc that doesn't change anything in your code tho
13 replies
MModular
Created by banananas on 10/23/2024 in #questions
Creating files from code
Yep, that works well honestly i'm surprised i didn't think of this earlier
10 replies
MModular
Created by banananas on 10/23/2024 in #questions
Creating files from code
Huh, really? I'm going to have to try that when I get home
10 replies
MModular
Created by banananas on 10/23/2024 in #questions
Creating files from code
That's the problem, I want to literally create a file
10 replies
MModular
Created by banananas on 10/1/2024 in #questions
Using structs that inherit from a specific trait as a type?
var thing = ecs.Entity(ecs.AnyList(ecs.BaseComponent()))
thing.addCpt(ecs.BaseComponent())
var thing = ecs.Entity(ecs.AnyList(ecs.BaseComponent()))
thing.addCpt(ecs.BaseComponent())
15 replies
MModular
Created by banananas on 10/1/2024 in #questions
Using structs that inherit from a specific trait as a type?
but it throws an error when i try this:
15 replies
MModular
Created by banananas on 10/1/2024 in #questions
Using structs that inherit from a specific trait as a type?
i ended up trying smth with object
15 replies
MModular
Created by banananas on 10/1/2024 in #questions
Using structs that inherit from a specific trait as a type?
alias AnyList = List[object]

trait Component:
fn __init__(inout self): ...
fn update(inout self): ...
fn render(inout self): ...

@value
struct BaseComponent(Component):
fn __init__(inout self): pass
fn update(inout self): pass
fn render(inout self): pass

struct Entity:
var components: AnyList

fn __init__(inout self, borrowed components: AnyList):
self.components = components

fn update(inout self) raises:
for i in range(self.components.__len__()):
self.components[i].update()

fn render(inout self) raises:
for i in range(self.components.__len__()):
self.components[i].render()

fn addCpt(inout self, value: object):
self.components.append(value)
alias AnyList = List[object]

trait Component:
fn __init__(inout self): ...
fn update(inout self): ...
fn render(inout self): ...

@value
struct BaseComponent(Component):
fn __init__(inout self): pass
fn update(inout self): pass
fn render(inout self): pass

struct Entity:
var components: AnyList

fn __init__(inout self, borrowed components: AnyList):
self.components = components

fn update(inout self) raises:
for i in range(self.components.__len__()):
self.components[i].update()

fn render(inout self) raises:
for i in range(self.components.__len__()):
self.components[i].render()

fn addCpt(inout self, value: object):
self.components.append(value)
15 replies
MModular
Created by banananas on 10/1/2024 in #questions
Using structs that inherit from a specific trait as a type?
Yeah it is :/
15 replies
MModular
Created by banananas on 10/1/2024 in #questions
Using structs that inherit from a specific trait as a type?
Ok... i'll see what i can do with that
15 replies
MModular
Created by banananas on 10/1/2024 in #questions
Using structs that inherit from a specific trait as a type?
No description
15 replies
MModular
Created by banananas on 9/28/2024 in #questions
Calling methods from list indexes
Alright, thanks
18 replies
MModular
Created by banananas on 9/28/2024 in #questions
Calling methods from list indexes
hopefully that was clear enough
18 replies
MModular
Created by banananas on 9/28/2024 in #questions
Calling methods from list indexes
I'm making an ECS (or sort of ECS) and i'm calling the update method of every component in an entity by cycling through a components list using a for loop. I'm trying to get the i index of components but it needs a type as well, but every component is listed in a variant so you don't have to specify the types of components in each method of every entity
18 replies
MModular
Created by banananas on 9/28/2024 in #questions
Calling methods from list indexes
alias ComponentList = Variant[
BaseComponent, # example
Variant[BaseComponent],
]
alias ComponentList = Variant[
BaseComponent, # example
Variant[BaseComponent],
]
also brings up the same error
18 replies
MModular
Created by banananas on 9/28/2024 in #questions
Calling methods from list indexes
That seems needlessly complicated but alright
18 replies