Random Chitchat 2012-2016
Depends, mostly on what the function params and return values are. If they're simple, like strings, numbers or class objects, then it's simple; if it's objects that Lua expresses as tables or callbacks, then it's a nightmare Wink

For the simple case, have a look at BlockID.h / .cpp, function BlockStringToType() . It is declared in the header inside a // tolua_begin and //tolua_end comment blocks, so the tolua parser will export it automagically. Then the function body is simply in BlockID.cpp as normal code. That's all there is - just wrapping the declaration in the tolua_* comments.

For the difficult case, you need to implement your functions and then write something colossal like there is in ManualBindings.cpp - those are the bindings for the difficult functions. You can try doing that, or simply ask, if it's good enough an idea, someone else here might write it for you Wink
Thanks given by:
It seems quite easy, thanks for the instructions!
Thanks given by:
Bit of an emergency, could someone merge this code in please (can't do it myself *cough* xoft *cough*)


#include "Globals.h"  // NOTE: MSVC stupidness requires this to be the same across all modules

#include "Cow.h"
#include "../Entities/Player.h"





cCow::cCow(void) :
	super("Cow", 92, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3)
{
}





void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
	AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER);
	AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}





void cCow::OnRightClicked(cPlayer & a_Player)
{
	if (a_Player.GetEquippedItem().m_ItemType == E_ITEM_BUCKET)
	{
		if (!a_Player.IsGameModeCreative())
		{
			a_Player.GetInventory().RemoveOneEquippedItem();
			a_Player.GetInventory().AddItem(E_ITEM_MILK);
		}
	}
}





Tonibm19 forgot a semicolon and an include, so now it doesn't compile.
Thanks given by:
I ain't touching the C++ code until all the hooks are documented.Tongue There aren't that many left, you know...
Thanks given by:
(10-16-2013, 06:47 AM)xoft Wrote: I ain't touching the C++ code until all the hooks are documented.Tongue There aren't that many left, you know...

Can I work on APIDump CSS + indentation? The current generated HTML is nigh on unreadable Smile
Thanks given by:
I found a loophole in your statement!

Can you please review mah APIDump PR?
Thanks given by:
And also take a look/merge mob spawning and my PRTongue.
Hope you finish all hooks today.

(10-16-2013, 06:37 AM)tigerw Wrote: Tonibm19 forgot a semicolon and an include, so now it doesn't compile.
Oh sorry I don't saw that. I'm not starting well to help MCServer Sad.
Then, why bearbin server compiled my PR well?
Thanks given by:
The generated HTML doesn't need to be readable, and the indentation makes it larger (bad when served online), but whatever, it's in.
Thanks given by:
Oh now I saw. Compile fails, but when I send PR it said Good to merge.
Thanks given by:
I will try and fix the buildserver being derpy Sad
Thanks given by:




Users browsing this thread: 31 Guest(s)