private static int RegisterBatteryReceiver(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil)); LuaFunction luaFunc = ToLua.CheckLuaFunction(L, 2); platformUtil.RegisterBatteryReceiver(luaFunc); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }