How I make when i don't have mobs mod my own mod load a .lua

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

How I make when i don't have mobs mod my own mod load a .lua

by MineYoshi » Sat Aug 06, 2016 20:27

I mean, if i don't have mobs mod, and i have the api in my mod, the api be loaded, if i have the mobs mod then don't...

How i make that?
I tried with this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if( minetest.get_modpath("mobs") ~= nil ) then
dofile(minetest.get_modpath("extramobs").."/api.lua"),
end


But i think that don't going to work how i want.
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: How I make when i don't have mobs mod my own mod load a

by rubenwardy » Sat Aug 06, 2016 20:51

That will run a file if the mod is enabled. Is that want you want? Why not just try it out. Also, so you don't need ~= nil
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: How I make when i don't have mobs mod my own mod load a

by MineYoshi » Sat Aug 06, 2016 20:55

I mean i want that when i don't have a mod, mine run a file...
How i do that?
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: How I make when i don't have mobs mod my own mod load a

by rubenwardy » Sat Aug 06, 2016 20:59

Simply negate the if statement's condition

if not minetest.get_modpath("mobs") then
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: How I make when i don't have mobs mod my own mod load a

by MineYoshi » Sat Aug 06, 2016 21:09

I didn't think about that, i was thinking about the api.
But well, i think i need to study a lot more...
Thanks!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron