Jump to content

is there a diffronts between these 2..function? (think there functions)

Recommended Posts

sorry im really a newbi at scripting even after playing with lua on off for years now >.< 

ok so in my mod im making "birdy" when u drop him on the ground it will attract birds just like the feather hat woud if its on your head (and play sounds but baby steps) but im not sure if it is attracting more birds or not

and from my messing around with the teddy bear from DST ive been using 

local function topocket(inst, owner)

local function toground(inst, owner)

but looking at the lightbulb.lua it has

local function OnDropped(inst)

local function OnPickup(inst)

so im wondering is there a diffronts between

"OnDropped / toground" and "OnPickup/topocket"


edit: heres a link to my mods github if any 1 wants to look at it to see if theres a diffront reason y its not attracting birds 

Edited by monkeybee
fix title
Link to comment
Share on other sites

1 hour ago, monkeybee said:

really? how comes swiching them around makes the game crash? o.O

Because of the executing code. As I already said, look where it is executed. There will be written the function name. Of course it must match at both positions (the function name must mnatch the name you are calling), but the name itself does not matter.
So in your mod you can call it whatever you want, as long as you call this function the right way.


You did not mention much about what you want to do. You only aked what is the difference. And I answered that you see the difference not in that code you quoted, you see it in the part were it is executed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...