Index: trunk/src/lua/lua_state.cc
===================================================================
--- trunk/src/lua/lua_state.cc	(revision 209)
+++ trunk/src/lua/lua_state.cc	(revision 212)
@@ -251,4 +251,13 @@
 }
 
+
+void lua::state_wrapper::register_native_function( lfunction f, const char* name )
+{
+	if ( m_global ) push_global_table();
+	lua_pushcfunction( m_state, f );
+	lua_setfield( m_state, -2, name );
+	if ( m_global ) pop_global_table();
+}
+
 void lua::state::log_stack()
 {
@@ -287,4 +296,16 @@
 	if ( t == nullptr ) return ref_none;
 	return register_object( o, t->name.c_str() );
+}
+
+void lua::state::register_native_object_method( const char* lua_name, const char* name, lfunction f )
+{
+	stack_guard guard( this );
+	lua_getglobal( m_state, lua_name );
+	if ( lua_isnil( m_state, -1 ) )
+	{
+		NV_THROW( runtime_error, std::string( lua_name ) + " type not registered!" );
+	}
+	lua_pushcfunction( m_state, f );
+	lua_setfield( m_state, -2, name );
 }
 
@@ -411,2 +432,7 @@
 	lua_settop( m_state, m_level );
 }
+
+int nv::lua::upvalue_index( int i )
+{
+	return lua_upvalueindex(i);
+}
